@bikdotai/bik-component-library 0.0.697 → 0.0.698-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) 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/data-source-panel/DataSourceInfoFooter.d.ts +1 -1
  7. package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.js +1 -1
  8. package/dist/cjs/components/data-source-panel/DataSourcePanel.d.ts +1 -1
  9. package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
  10. package/dist/cjs/components/discount-modal/DiscountModal.d.ts +1 -1
  11. package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
  12. package/dist/cjs/components/dropdown/Common.styled.d.ts +1 -0
  13. package/dist/cjs/components/dropdown/Common.styled.js +3 -3
  14. package/dist/cjs/components/dropdown/DropdownPopover/index.d.ts +1 -0
  15. package/dist/cjs/components/dropdown/DropdownPopover/index.js +1 -1
  16. package/dist/cjs/components/dropdown-button/DropdownButton.js +1 -1
  17. package/dist/cjs/components/dropdown-button/DropdownButton.style.d.ts +1 -0
  18. package/dist/cjs/components/dropdown-button/DropdownButton.style.js +16 -3
  19. package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +1 -1
  20. package/dist/cjs/components/product-picker-v2/modal.d.ts +1 -1
  21. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  22. package/dist/cjs/components/product-picker-v2/productScreen.d.ts +1 -1
  23. package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +1 -1
  24. package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +1 -1
  25. package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +1 -1
  26. package/dist/cjs/components/product-picker-v2/utility.d.ts +1 -1
  27. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +1 -1
  28. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +1 -1
  29. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  30. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
  31. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  32. package/dist/cjs/components/template-context-mapper/utils/constants.d.ts +1 -0
  33. package/dist/cjs/components/template-context-mapper/utils/constants.js +1 -1
  34. package/dist/cjs/components/template-preview/models/TemplateMeta.d.ts +5 -0
  35. package/dist/cjs/components/template-preview/models/TemplateMeta.js +1 -1
  36. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +1 -1
  37. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
  38. package/dist/cjs/index.js +1 -1
  39. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  40. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  41. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  42. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  43. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  44. package/dist/esm/components/data-source-panel/DataSourceInfoFooter.d.ts +1 -1
  45. package/dist/esm/components/data-source-panel/DataSourceInfoFooter.js +1 -1
  46. package/dist/esm/components/data-source-panel/DataSourcePanel.d.ts +1 -1
  47. package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
  48. package/dist/esm/components/discount-modal/DiscountModal.d.ts +1 -1
  49. package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
  50. package/dist/esm/components/dropdown/Common.styled.d.ts +1 -0
  51. package/dist/esm/components/dropdown/Common.styled.js +4 -4
  52. package/dist/esm/components/dropdown/DropdownPopover/index.d.ts +1 -0
  53. package/dist/esm/components/dropdown/DropdownPopover/index.js +1 -1
  54. package/dist/esm/components/dropdown-button/DropdownButton.js +1 -1
  55. package/dist/esm/components/dropdown-button/DropdownButton.style.d.ts +1 -0
  56. package/dist/esm/components/dropdown-button/DropdownButton.style.js +17 -4
  57. package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +1 -1
  58. package/dist/esm/components/product-picker-v2/modal.d.ts +1 -1
  59. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  60. package/dist/esm/components/product-picker-v2/productScreen.d.ts +1 -1
  61. package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +1 -1
  62. package/dist/esm/components/product-picker-v2/searchScreen.d.ts +1 -1
  63. package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +1 -1
  64. package/dist/esm/components/product-picker-v2/utility.d.ts +1 -1
  65. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +1 -1
  66. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +1 -1
  67. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  68. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
  69. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  70. package/dist/esm/components/template-context-mapper/utils/constants.d.ts +1 -0
  71. package/dist/esm/components/template-context-mapper/utils/constants.js +1 -1
  72. package/dist/esm/components/template-preview/models/TemplateMeta.d.ts +5 -0
  73. package/dist/esm/components/template-preview/models/TemplateMeta.js +1 -1
  74. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +1 -1
  75. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
  76. package/dist/esm/index.js +1 -1
  77. 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,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ApplicationType } from '@bikdotai/bik-models/growth';
2
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
3
  import { footerButtonOptionModel, MessageSource } from './model';
4
4
  interface SourceInfoFooterProps {
5
5
  appType: ApplicationType;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth"),i=require("../../assets/icons/alert_triangle.svg.js"),s=require("../../assets/icons/plus.svg.js"),n=require("react"),o=require("../../constants/Theme.js"),r=require("../button/Button.js"),a=require("../shimmer/ShimmerComponent/BikShimmer.js"),d=require("../TypographyStyle.js"),l=require("./DataSourcePanel.style.js");const u=n.memo((u=>{const{appType:x,sourceIntent:m,hideHeading:h,messageSource:j,trainingSourceCount:g={},ShowTrainingDataSource:R={},faqCount:v,ChecklistType:E,footerButtonOption:y,isFooterLoading:T,reasonForAiGeneratedResponse:b,showAiResponseReason:A,aiResponseLoading:O}=u,C=R,[S,f]=n.useState(!0),[I,F]=n.useState(!0),_="/bik-ai/training",[w,N]=n.useState({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[k,D]=n.useState({title:"",subTitle:""}),L=n.useMemo((()=>{const e=(null==g?void 0:g[m])||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,m]),q=()=>{var e;(null==w?void 0:w.redirectUrl)?window.open(`${window.location.origin}${null==w?void 0:w.redirectUrl}`,"_self"):Object.keys(null!==(e=null==w?void 0:w.addFaqProps)&&void 0!==e?e:{}).length>0?null==y||y.onClick(w):(null==y?void 0:y.navigate)&&(null==y||y.navigate("Training",x==t.ApplicationType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return n.useEffect((()=>{var e,i,s,n;if(m){if(null===(e=null==j?void 0:j.sources)||void 0===e?void 0:e.length){const e=j.sources[0];if(C[m])m===E.ORDER_ENQUIRY&&F(!1);else{let o=null==e?void 0:e.insights,r="";switch(m){case E.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(o=`${v||"No"} FAQs added for this product`,r="Add product-specific information via FAQs to improve responses",N({buttonTitle:"Add FAQ",addFaqProps:{faqProducts:[{id:null==e?void 0:e.productId,variantId:null==e?void 0:e.variantId,name:null==e?void 0:e.title,imageUrl:null==e?void 0:e.imageUrl}]},redirectUrl:""}));break;case E.ORDER_MODIFICATION:o=(null==g?void 0:g[m])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",o&&N({buttonTitle:x==t.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:x==t.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":_,addFaqProps:{}});break;case E.ORDER_CANCELLATION:o=(null==g?void 0:g[m])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",N({buttonTitle:x==t.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:x==t.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":_,addFaqProps:{}});break;case E.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;N({buttonTitle:x==t.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:x==t.ApplicationType.MANIFEST?"/training/order-management":_,addFaqProps:{}});break;case E.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(n=null===(s=null===(i=null==j?void 0:j.sources)||void 0===i?void 0:i[0])||void 0===s?void 0:s.title)||void 0===n?void 0:n.toLowerCase().indexOf("collection"))){o="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}o="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}D({title:null!=o?o:"",subTitle:r})}}(C[m]||[E.PRODUCT_DETAILS,E.ORDER_MODIFICATION,E.ORDER_CANCELLATION,E.ORDER_TRACKING].includes(m))&&f(!1)}}),[null==j?void 0:j.messageId,g,m,null==j?void 0:j.sources,C,E,v,x,j]),e.jsxRuntimeExports.jsx(l.SourceInfoFooterStyle,{children:T?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(a.BikShimmer,{gap:"8px",direction:"column",boxes:[{height:"20px",width:"300px"},{height:"80px",width:"300px"}]})}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:!(null==k?void 0:k.title)&&g&&m in g?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(c,{hideHeading:null!=h&&h}),e.jsxRuntimeExports.jsx(p,{reason:b||"",showAiResponseReason:null!=A&&A,isLoading:null!=O&&O,appType:x}),e.jsxRuntimeExports.jsxs("div",Object.assign({className:"source_info_details "+(g[m]>0?"":"no_data_source")},{children:[g[m]>0&&I?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(d.BodyCaption,{children:L}),e.jsxRuntimeExports.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):I&&e.jsxRuntimeExports.jsxs("div",Object.assign({className:"no_data_source_title"},{children:[e.jsxRuntimeExports.jsx(i.default,{width:15,height:15,color:o.COLORS.content.negative,style:{marginTop:2}}),e.jsxRuntimeExports.jsx(d.BodyCaption,{children:"No data sources added to the identified link"})]})),!y||y.hideAddDataButton||S?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsx(r.Button,{size:"small",buttonType:"tertiary",LeadingIcon:s.default,buttonText:(null==w?void 0:w.buttonTitle.length)>0?null==w?void 0:w.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>q(),style:{backgroundColor:"unset"}})]}))]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(c,{hideHeading:null!=h&&h}),e.jsxRuntimeExports.jsx(p,{reason:b||"",showAiResponseReason:null!=A&&A,isLoading:null!=O&&O,appType:x}),e.jsxRuntimeExports.jsxs("div",Object.assign({className:"source_info_details"},{children:[I&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(d.BodyCaption,{children:null==k?void 0:k.title}),e.jsxRuntimeExports.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:null==k?void 0:k.subTitle}))]}),!y||y.hideAddDataButton||S?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsx(r.Button,{size:"small",buttonType:"tertiary",LeadingIcon:s.default,buttonText:(null==w?void 0:w.buttonTitle.length)>0?null==w?void 0:w.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>q(),style:{backgroundColor:"unset"}})]}))]})})})})),c=n.memo((t=>t.hideHeading?null:e.jsxRuntimeExports.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:"Training insights"})))),p=n.memo((i=>{const[s,r]=n.useState(!1),l=i.reason&&i.reason.length>150,u=l&&!s?i.reason.substring(0,150)+"...":i.reason;return i.appType!==t.ApplicationType.MANIFEST?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:i.isLoading?e.jsxRuntimeExports.jsx("div",Object.assign({style:{height:70,width:"100%",marginBottom:8}},{children:e.jsxRuntimeExports.jsx(a.BikShimmer,{boxes:[{height:"20px",width:"30%"},{height:"20px",width:"100%"}],direction:"column",gap:"2px",isBrand:!1})})):e.jsxRuntimeExports.jsxs("div",Object.assign({className:"source_info_details"},{children:[e.jsxRuntimeExports.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.primary,className:"why_ai_gave_this_response"},{children:"Here’s why your AI gave this response"})),e.jsxRuntimeExports.jsxs(d.BodyCaption,Object.assign({color:o.COLORS.content.secondary,className:"clamp-text"},{children:[u||"No reason provided for this response.",l&&e.jsxRuntimeExports.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.brand,style:{cursor:"pointer",textDecoration:"underline",marginTop:"4px"},onClick:()=>r(!s)},{children:s?"Show less":"Show more"}))]}))]}))})}));p.displayName="WhyAiGaveThisResponse",c.displayName="TrainingInsightsHeading",u.displayName="SourceInfoFooter",exports.default=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth/models/bik-store"),i=require("../../assets/icons/alert_triangle.svg.js"),s=require("../../assets/icons/plus.svg.js"),n=require("react"),o=require("../../constants/Theme.js"),r=require("../button/Button.js"),a=require("../shimmer/ShimmerComponent/BikShimmer.js"),d=require("../TypographyStyle.js"),l=require("./DataSourcePanel.style.js");const u=n.memo((u=>{const{appType:x,sourceIntent:m,hideHeading:h,messageSource:j,trainingSourceCount:g={},ShowTrainingDataSource:R={},faqCount:v,ChecklistType:E,footerButtonOption:y,isFooterLoading:T,reasonForAiGeneratedResponse:b,showAiResponseReason:A,aiResponseLoading:O}=u,C=R,[S,f]=n.useState(!0),[I,F]=n.useState(!0),_="/bik-ai/training",[w,N]=n.useState({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[k,D]=n.useState({title:"",subTitle:""}),L=n.useMemo((()=>{const e=(null==g?void 0:g[m])||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,m]),q=()=>{var e;(null==w?void 0:w.redirectUrl)?window.open(`${window.location.origin}${null==w?void 0:w.redirectUrl}`,"_self"):Object.keys(null!==(e=null==w?void 0:w.addFaqProps)&&void 0!==e?e:{}).length>0?null==y||y.onClick(w):(null==y?void 0:y.navigate)&&(null==y||y.navigate("Training",x==t.ApplicationType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return n.useEffect((()=>{var e,i,s,n;if(m){if(null===(e=null==j?void 0:j.sources)||void 0===e?void 0:e.length){const e=j.sources[0];if(C[m])m===E.ORDER_ENQUIRY&&F(!1);else{let o=null==e?void 0:e.insights,r="";switch(m){case E.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(o=`${v||"No"} FAQs added for this product`,r="Add product-specific information via FAQs to improve responses",N({buttonTitle:"Add FAQ",addFaqProps:{faqProducts:[{id:null==e?void 0:e.productId,variantId:null==e?void 0:e.variantId,name:null==e?void 0:e.title,imageUrl:null==e?void 0:e.imageUrl}]},redirectUrl:""}));break;case E.ORDER_MODIFICATION:o=(null==g?void 0:g[m])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",o&&N({buttonTitle:x==t.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:x==t.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":_,addFaqProps:{}});break;case E.ORDER_CANCELLATION:o=(null==g?void 0:g[m])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",N({buttonTitle:x==t.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:x==t.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":_,addFaqProps:{}});break;case E.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;N({buttonTitle:x==t.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:x==t.ApplicationType.MANIFEST?"/training/order-management":_,addFaqProps:{}});break;case E.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(n=null===(s=null===(i=null==j?void 0:j.sources)||void 0===i?void 0:i[0])||void 0===s?void 0:s.title)||void 0===n?void 0:n.toLowerCase().indexOf("collection"))){o="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}o="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}D({title:null!=o?o:"",subTitle:r})}}(C[m]||[E.PRODUCT_DETAILS,E.ORDER_MODIFICATION,E.ORDER_CANCELLATION,E.ORDER_TRACKING].includes(m))&&f(!1)}}),[null==j?void 0:j.messageId,g,m,null==j?void 0:j.sources,C,E,v,x,j]),e.jsxRuntimeExports.jsx(l.SourceInfoFooterStyle,{children:T?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(a.BikShimmer,{gap:"8px",direction:"column",boxes:[{height:"20px",width:"300px"},{height:"80px",width:"300px"}]})}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:!(null==k?void 0:k.title)&&g&&m in g?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(c,{hideHeading:null!=h&&h}),e.jsxRuntimeExports.jsx(p,{reason:b||"",showAiResponseReason:null!=A&&A,isLoading:null!=O&&O,appType:x}),e.jsxRuntimeExports.jsxs("div",Object.assign({className:"source_info_details "+(g[m]>0?"":"no_data_source")},{children:[g[m]>0&&I?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(d.BodyCaption,{children:L}),e.jsxRuntimeExports.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):I&&e.jsxRuntimeExports.jsxs("div",Object.assign({className:"no_data_source_title"},{children:[e.jsxRuntimeExports.jsx(i.default,{width:15,height:15,color:o.COLORS.content.negative,style:{marginTop:2}}),e.jsxRuntimeExports.jsx(d.BodyCaption,{children:"No data sources added to the identified link"})]})),!y||y.hideAddDataButton||S?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsx(r.Button,{size:"small",buttonType:"tertiary",LeadingIcon:s.default,buttonText:(null==w?void 0:w.buttonTitle.length)>0?null==w?void 0:w.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>q(),style:{backgroundColor:"unset"}})]}))]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(c,{hideHeading:null!=h&&h}),e.jsxRuntimeExports.jsx(p,{reason:b||"",showAiResponseReason:null!=A&&A,isLoading:null!=O&&O,appType:x}),e.jsxRuntimeExports.jsxs("div",Object.assign({className:"source_info_details"},{children:[I&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(d.BodyCaption,{children:null==k?void 0:k.title}),e.jsxRuntimeExports.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:null==k?void 0:k.subTitle}))]}),!y||y.hideAddDataButton||S?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsx(r.Button,{size:"small",buttonType:"tertiary",LeadingIcon:s.default,buttonText:(null==w?void 0:w.buttonTitle.length)>0?null==w?void 0:w.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>q(),style:{backgroundColor:"unset"}})]}))]})})})})),c=n.memo((t=>t.hideHeading?null:e.jsxRuntimeExports.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:"Training insights"})))),p=n.memo((i=>{const[s,r]=n.useState(!1),l=i.reason&&i.reason.length>150,u=l&&!s?i.reason.substring(0,150)+"...":i.reason;return i.appType!==t.ApplicationType.MANIFEST?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:i.isLoading?e.jsxRuntimeExports.jsx("div",Object.assign({style:{height:70,width:"100%",marginBottom:8}},{children:e.jsxRuntimeExports.jsx(a.BikShimmer,{boxes:[{height:"20px",width:"30%"},{height:"20px",width:"100%"}],direction:"column",gap:"2px",isBrand:!1})})):e.jsxRuntimeExports.jsxs("div",Object.assign({className:"source_info_details"},{children:[e.jsxRuntimeExports.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.primary,className:"why_ai_gave_this_response"},{children:"Here’s why your AI gave this response"})),e.jsxRuntimeExports.jsxs(d.BodyCaption,Object.assign({color:o.COLORS.content.secondary,className:"clamp-text"},{children:[u||"No reason provided for this response.",l&&e.jsxRuntimeExports.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.brand,style:{cursor:"pointer",textDecoration:"underline",marginTop:"4px"},onClick:()=>r(!s)},{children:s?"Show less":"Show more"}))]}))]}))})}));p.displayName="WhyAiGaveThisResponse",c.displayName="TrainingInsightsHeading",u.displayName="SourceInfoFooter",exports.default=u;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ApplicationType } from '@bikdotai/bik-models/growth';
2
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
3
  import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource, ProductSourceData } from './model';
4
4
  export interface ProductSearchRuleDB {
5
5
  rule_id?: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth"),s=require("../../assets/icons/box_search.svg.js"),i=require("../../assets/icons/boxV2.svg.js"),o=require("../../assets/icons/chevronDownOutline.svg.js"),n=require("../../assets/icons/chevronUpOutline.svg.js"),r=require("../../assets/icons/cross.svg.js"),l=require("../../assets/icons/edit.svg.js"),a=require("../../assets/icons/filePdf.svg.js"),d=require("../../assets/icons/help.svg.js"),c=require("../../assets/icons/info.svg.js"),x=require("../../assets/icons/openai.svg.js"),u=require("../../assets/icons/plus.svg.js"),p=require("../../assets/icons/redirect.svg.js"),j=require("../../assets/icons/text_t9.svg.js"),m=require("../../assets/icons/website.svg.js"),g=require("react"),h=require("../../constants/Theme.js"),y=require("../button/Button.js"),E=require("../icon-button/IconButton.js"),C=require("../shimmer/ShimmerComponent/BikShimmer.js"),R=require("../side-modal/SideModal.js"),O=require("../tag/Tag.js"),f=require("../tooltips/Tooltip.js"),v=require("../TypographyStyle.js"),S=require("./DataSourceInfoFooter.js"),T=require("./DataSourcePanel.style.js"),I=require("./IntentConfig.js"),b=require("./Modals/DescriptionModal.js"),L=require("./model.js");exports.DataSourcePanel=w=>{var D,N;const{appType:A,storeId:_,messageSource:k,setMessageSourcePanel:F,hideCloseButton:B,isSourceInfoFetched:q,allSourceInfoDetail:P,ChecklistType:M,title:U,zeroStateButton:K,editableSources:W,preFillTrainingSourceCount:$,redirect:H,footerButtonOption:Q,fetchTrainingSourceCount:G,fetchProductFAQCount:Y,productSourceData:z,reasonForAiGeneratedResponse:X,showAiResponseReason:V,aiResponseLoading:J,productSearchRule:Z,onEditProductSearchRule:ee}=w,{sources:te}=k,se=["blog","article","page","policy"],[ie,oe]=g.useState(!1),[ne,re]=g.useState(!1),[le,ae]=g.useState(!1),[de,ce]=g.useState(0),[xe,ue]=g.useState(),[pe,je]=g.useState(null!=$?$:{}),[me,ge]=g.useState(!1),[he,ye]=g.useState(!1),Ee={};I.intentConfig.forEach((t=>{let{key:s,type:i,tagText:o}=t;M[s]&&(Ee[M[s]]=e.jsxRuntimeExports.jsx(O.Tag,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const Ce=te.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Re=te.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),Oe=g.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=>{M[t]&&(e[M[t]]=M[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[M]);g.useEffect((()=>{var e,t,s,i;if(!(null==k?void 0:k.messageId))return;oe(!0),re(!0),ae(!1!==(null===(t=null===(e=k.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=k.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights));const o=k.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));Y(_,n).then((e=>ce(e))).then((()=>{$?(je($),setTimeout((()=>{oe(!1),re(!1)}),100)):(setTimeout((()=>oe(!1)),100),G(_).then((e=>je(e))).then((()=>setTimeout((()=>{re(!1)}),100))))}))}),[Y,G,null==k?void 0:k.messageId,k.sources,$,_]);const fe=e=>!!(e&&0===e.length||(null==k?void 0:k.isUnsatisfactoryAnswer)),ve=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=L.CustomDataType.FILES:se.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," ")},Se=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",Te=t=>"products"==t||"product"==t?e.jsxRuntimeExports.jsx(i.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==t?e.jsxRuntimeExports.jsx(a.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==t||"fetched links"==t?e.jsxRuntimeExports.jsx(m.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==t?e.jsxRuntimeExports.jsx(d.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==t?e.jsxRuntimeExports.jsx(j.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsxRuntimeExports.jsx(x.default,{height:16,width:16,color:h.COLORS.content.secondary}),Ie=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};if(ie||!q)return e.jsxRuntimeExports.jsx(T.SourceInfoDetailsStyle,{children:e.jsxRuntimeExports.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"}]})});const be=s=>{const{title:i,count:r,isExpanded:l,onToggle:a,children:d}=s;return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:a},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e.jsxRuntimeExports.jsx(v.BodySecondary,{children:i}),A===t.ApplicationType.MANIFEST?e.jsxRuntimeExports.jsx("div",Object.assign({style:{backgroundColor:h.COLORS.surface.subdued,color:h.COLORS.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500",border:`1px solid ${h.COLORS.stroke.primary}`}},{children:r})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]})),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:A===t.ApplicationType.BIK?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):l?e.jsxRuntimeExports.jsx(n.default,{width:20,height:20,color:h.COLORS.content.primary}):e.jsxRuntimeExports.jsx(o.default,{width:20,height:20,color:h.COLORS.content.primary})})]})),l&&d]})};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(T.SourceInfoDetailsStyle,{children:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",padding:0,paddingBottom:"12px"}},{children:[!!U&&e.jsxRuntimeExports.jsx(v.TitleSmall,{children:U}),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(D=Ee[k.intent])&&void 0!==D?D:Ee.GENERIC,!B&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>F(void 0)},{children:e.jsxRuntimeExports.jsx(r.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),Z&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"12px",marginTop:"6px"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({color:h.COLORS.content.primary},{children:Z.rule_name})),ee&&Z.rule_id&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[e.jsxRuntimeExports.jsx(s.default,{width:14,color:h.COLORS.content.secondary}),e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Edit search rule"})),e.jsxRuntimeExports.jsx(E.IconButton,{Icon:l.default,height:16,width:16,bordered:!0,iconColor:h.COLORS.content.primary,onClick:()=>ee(null==Z?void 0:Z.rule_id)})]}))]})),Z.keywords&&Z.keywords.length>0&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px",backgroundColor:h.COLORS.surface.subdued,borderRadius:"8px",border:`1px dashed ${h.COLORS.stroke.primary}`}},{children:Z.keywords.map(((t,s)=>e.jsxRuntimeExports.jsx(O.Tag,{tagText:t,theme:"light"},`keyword-${s}`)))}))]})),fe(te)?e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsxRuntimeExports.jsx(c.default,{width:24,height:24,color:h.COLORS.stroke.negative.vibrant})})),e.jsxRuntimeExports.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsxRuntimeExports.jsx(v.TitleSmall,{children:"Insufficient data"})})),e.jsxRuntimeExports.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"})),K&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsxRuntimeExports.jsx(y.Button,{LeadingIcon:null!==(t=K.leadingIcon)&&void 0!==t?t:u.default,buttonText:null!==(s=K.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{K.onClick()}})}))]}))})()})):!Z&&e.jsxRuntimeExports.jsx(O.Tag,{LeadingIcon:c.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:k.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 ${A===t.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),le&&!fe(te)&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"footer"},{children:e.jsxRuntimeExports.jsx(S.default,{appType:A,storeId:_,messageSource:k,sourceIntent:null!==(N=k.intent)&&void 0!==N?N:M.GENERIC,faqCount:de,trainingSourceCount:pe,ShowTrainingDataSource:Oe,ChecklistType:M,footerButtonOption:Q,isFooterLoading:ne,reasonForAiGeneratedResponse:X,showAiResponseReason:V,aiResponseLoading:J})})),!fe(te)&&e.jsxRuntimeExports.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Ce.length>0&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"info-product-source"},{children:e.jsxRuntimeExports.jsx(be,Object.assign({title:"Product Sources",count:Ce.length,isExpanded:A!==t.ApplicationType.MANIFEST||me,onToggle:()=>ge(!me)},{children:e.jsxRuntimeExports.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Ce.map(((t,s)=>{var i,o,n,r;const a=ve(t.type||t.subTitle||"OpenAI"),d=ve(t.type||t.subTitle||"OpenAI",!0),c=Se(a),x=null==W?void 0:W.includes(d),u=P[null!==(i=t.productId)&&void 0!==i?i:"Products"],j=t.title,m=t.productId&&(null==z?void 0:z[t.productId]),g=m&&m.metafield.join(", ");return e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Ce?void 0:Ce.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Te(a),e.jsxRuntimeExports.jsx(f.Tooltip,Object.assign({body:j,placement:"top"},{children:e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({style:d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:j}))}))]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==M.EMAIL_COLLECTION&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:c}))}),(t.link||t.docId)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:x?e.jsxRuntimeExports.jsx(E.IconButton,{Icon:l.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==u?void 0:u.onEditClick(u.data,u.type),disabled:!u,disabledTooltip:"This source is deleted"}):e.jsxRuntimeExports.jsx(E.IconButton,{Icon:p.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!u,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),m&&e.jsxRuntimeExports.jsxs(v.BodyCaption,{children:[e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;ue({title:j,description:Ie(m.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>ue(void 0)})}},{children:`${null===(o=m.description)||void 0===o?void 0:o.length} characters description,`})),e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>m.onEditFaqClick(m.faqs)},{children:`${null===(n=m.faqs)||void 0===n?void 0:n.length} FAQs, `})),e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsxRuntimeExports.jsx(f.Tooltip,Object.assign({body:g,placement:"top"},{children:e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(r=m.metafield)||void 0===r?void 0:r.length} metafields`}))}))]})]}),`info-${s}`)}))}))}))}))}),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Re.length>0&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"info-content-source"},{children:e.jsxRuntimeExports.jsx(be,Object.assign({title:"Content Sources",count:Re.length,isExpanded:A!==t.ApplicationType.MANIFEST||he,onToggle:()=>ye(!he)},{children:e.jsxRuntimeExports.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Re.map(((t,s)=>{var i,o,n,r,a,d,c,x,u,j,m,g,y,C,R,O,S;const T=ve(t.type||t.subTitle||"OpenAI"),I=ve(t.type||t.subTitle||"OpenAI",!0),b=Se(T),w=null==W?void 0:W.includes(I),D="Products"===t.subTitle?P[null!==(i=t.productId)&&void 0!==i?i:"Products"]:P[null!==(o=t.docId)&&void 0!==o?o:""],N=I.toLowerCase()===(null===(n=L.CustomDataType.FAQ)||void 0===n?void 0:n.toLowerCase())?"faq"===(null===(r=t.title)||void 0===r?void 0:r.toLowerCase())?t.subTitle:t.title:I.toLowerCase()===(null===(a=L.CustomDataType.FILES)||void 0===a?void 0:a.toLowerCase())||I.toLowerCase()===(null===(d=L.CustomDataType.FETCHED_LINKS)||void 0===d?void 0:d.toLowerCase())||I.toLowerCase()===(null===(c=L.CustomDataType.TEXTS)||void 0===c?void 0:c.toLowerCase())?t.title:I.toLowerCase()===(null===(x=L.CustomDataType.WEBSITE_LINKS)||void 0===x?void 0:x.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):t.intent===M.EMAIL_COLLECTION?b:t.title,A="faq"===I.toLowerCase()?null!==(m=null!==(u=null==D?void 0:D.content)&&void 0!==u?u:null===(j=null==D?void 0:D.data)||void 0===j?void 0:j.answer)&&void 0!==m?m:"":I.toLowerCase()===(null===(g=L.CustomDataType.FETCHED_LINKS)||void 0===g?void 0:g.toLowerCase())||I.toLowerCase()===(null===(y=L.CustomDataType.WEBSITE_LINKS)||void 0===y?void 0:y.toLowerCase())||I.toLowerCase()===(null===(C=L.CustomDataType.TEXTS)||void 0===C?void 0:C.toLowerCase())?null!==(S=null!==(R=null==D?void 0:D.content)&&void 0!==R?R:null===(O=null==D?void 0:D.data)||void 0===O?void 0:O.fileContentText)&&void 0!==S?S:"":t.intent===M.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Re?void 0:Re.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Te(T),e.jsxRuntimeExports.jsx(f.Tooltip,Object.assign({body:N,placement:"top"},{children:e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({style:I==L.CustomDataType.FETCHED_LINKS||I==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>I==L.CustomDataType.FETCHED_LINKS||I==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:N}))}))]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==M.EMAIL_COLLECTION&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:b}))}),(t.link||t.docId)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:w?e.jsxRuntimeExports.jsx(E.IconButton,{Icon:l.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==D?void 0:D.onEditClick(D.data,D.type),disabled:!D,disabledTooltip:"This source is deleted"}):e.jsxRuntimeExports.jsx(E.IconButton,{Icon:p.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!D,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),(null!=A?A:"").trim()&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:Ie(null!=A?A:"").trim()}))}))]}),`info-${s}`)}))}))}))}))})]}))]})}),xe&&e.jsxRuntimeExports.jsx(R.SideModal,Object.assign({header:"Product description",onClose:()=>ue(void 0),width:"30%"},{children:e.jsxRuntimeExports.jsx(b.DescriptionModal,{title:xe.title,description:xe.description,imageUrl:xe.imageUrl,onClose:xe.onClose})}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth/models/bik-store"),s=require("../../assets/icons/box_search.svg.js"),i=require("../../assets/icons/boxV2.svg.js"),o=require("../../assets/icons/chevronDownOutline.svg.js"),n=require("../../assets/icons/chevronUpOutline.svg.js"),r=require("../../assets/icons/cross.svg.js"),l=require("../../assets/icons/edit.svg.js"),a=require("../../assets/icons/filePdf.svg.js"),d=require("../../assets/icons/help.svg.js"),c=require("../../assets/icons/info.svg.js"),x=require("../../assets/icons/openai.svg.js"),u=require("../../assets/icons/plus.svg.js"),p=require("../../assets/icons/redirect.svg.js"),j=require("../../assets/icons/text_t9.svg.js"),m=require("../../assets/icons/website.svg.js"),g=require("react"),h=require("../../constants/Theme.js"),y=require("../button/Button.js"),E=require("../icon-button/IconButton.js"),C=require("../shimmer/ShimmerComponent/BikShimmer.js"),R=require("../side-modal/SideModal.js"),O=require("../tag/Tag.js"),f=require("../tooltips/Tooltip.js"),v=require("../TypographyStyle.js"),S=require("./DataSourceInfoFooter.js"),T=require("./DataSourcePanel.style.js"),I=require("./IntentConfig.js"),b=require("./Modals/DescriptionModal.js"),L=require("./model.js");exports.DataSourcePanel=w=>{var D,N;const{appType:A,storeId:k,messageSource:_,setMessageSourcePanel:F,hideCloseButton:B,isSourceInfoFetched:q,allSourceInfoDetail:P,ChecklistType:M,title:U,zeroStateButton:K,editableSources:W,preFillTrainingSourceCount:$,redirect:H,footerButtonOption:Q,fetchTrainingSourceCount:G,fetchProductFAQCount:Y,productSourceData:z,reasonForAiGeneratedResponse:X,showAiResponseReason:V,aiResponseLoading:J,productSearchRule:Z,onEditProductSearchRule:ee}=w,{sources:te}=_,se=["blog","article","page","policy"],[ie,oe]=g.useState(!1),[ne,re]=g.useState(!1),[le,ae]=g.useState(!1),[de,ce]=g.useState(0),[xe,ue]=g.useState(),[pe,je]=g.useState(null!=$?$:{}),[me,ge]=g.useState(!1),[he,ye]=g.useState(!1),Ee={};I.intentConfig.forEach((t=>{let{key:s,type:i,tagText:o}=t;M[s]&&(Ee[M[s]]=e.jsxRuntimeExports.jsx(O.Tag,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const Ce=te.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Re=te.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),Oe=g.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=>{M[t]&&(e[M[t]]=M[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[M]);g.useEffect((()=>{var e,t,s,i;if(!(null==_?void 0:_.messageId))return;oe(!0),re(!0),ae(!1!==(null===(t=null===(e=_.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=_.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights));const o=_.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));Y(k,n).then((e=>ce(e))).then((()=>{$?(je($),setTimeout((()=>{oe(!1),re(!1)}),100)):(setTimeout((()=>oe(!1)),100),G(k).then((e=>je(e))).then((()=>setTimeout((()=>{re(!1)}),100))))}))}),[Y,G,null==_?void 0:_.messageId,_.sources,$,k]);const fe=e=>!!(e&&0===e.length||(null==_?void 0:_.isUnsatisfactoryAnswer)),ve=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=L.CustomDataType.FILES:se.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," ")},Se=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",Te=t=>"products"==t||"product"==t?e.jsxRuntimeExports.jsx(i.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==t?e.jsxRuntimeExports.jsx(a.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==t||"fetched links"==t?e.jsxRuntimeExports.jsx(m.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==t?e.jsxRuntimeExports.jsx(d.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==t?e.jsxRuntimeExports.jsx(j.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsxRuntimeExports.jsx(x.default,{height:16,width:16,color:h.COLORS.content.secondary}),Ie=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};if(ie||!q)return e.jsxRuntimeExports.jsx(T.SourceInfoDetailsStyle,{children:e.jsxRuntimeExports.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"}]})});const be=s=>{const{title:i,count:r,isExpanded:l,onToggle:a,children:d}=s;return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:a},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e.jsxRuntimeExports.jsx(v.BodySecondary,{children:i}),A===t.ApplicationType.MANIFEST?e.jsxRuntimeExports.jsx("div",Object.assign({style:{backgroundColor:h.COLORS.surface.subdued,color:h.COLORS.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500",border:`1px solid ${h.COLORS.stroke.primary}`}},{children:r})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]})),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:A===t.ApplicationType.BIK?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):l?e.jsxRuntimeExports.jsx(n.default,{width:20,height:20,color:h.COLORS.content.primary}):e.jsxRuntimeExports.jsx(o.default,{width:20,height:20,color:h.COLORS.content.primary})})]})),l&&d]})};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(T.SourceInfoDetailsStyle,{children:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",padding:0,paddingBottom:"12px"}},{children:[!!U&&e.jsxRuntimeExports.jsx(v.TitleSmall,{children:U}),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(D=Ee[_.intent])&&void 0!==D?D:Ee.GENERIC,!B&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>F(void 0)},{children:e.jsxRuntimeExports.jsx(r.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),Z&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"12px",marginTop:"6px"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({color:h.COLORS.content.primary},{children:Z.rule_name})),ee&&Z.rule_id&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[e.jsxRuntimeExports.jsx(s.default,{width:14,color:h.COLORS.content.secondary}),e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Edit search rule"})),e.jsxRuntimeExports.jsx(E.IconButton,{Icon:l.default,height:16,width:16,bordered:!0,iconColor:h.COLORS.content.primary,onClick:()=>ee(null==Z?void 0:Z.rule_id)})]}))]})),Z.keywords&&Z.keywords.length>0&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px",backgroundColor:h.COLORS.surface.subdued,borderRadius:"8px",border:`1px dashed ${h.COLORS.stroke.primary}`}},{children:Z.keywords.map(((t,s)=>e.jsxRuntimeExports.jsx(O.Tag,{tagText:t,theme:"light"},`keyword-${s}`)))}))]})),fe(te)?e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsxRuntimeExports.jsx(c.default,{width:24,height:24,color:h.COLORS.stroke.negative.vibrant})})),e.jsxRuntimeExports.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsxRuntimeExports.jsx(v.TitleSmall,{children:"Insufficient data"})})),e.jsxRuntimeExports.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"})),K&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsxRuntimeExports.jsx(y.Button,{LeadingIcon:null!==(t=K.leadingIcon)&&void 0!==t?t:u.default,buttonText:null!==(s=K.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{K.onClick()}})}))]}))})()})):!Z&&e.jsxRuntimeExports.jsx(O.Tag,{LeadingIcon:c.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:_.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 ${A===t.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),le&&!fe(te)&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"footer"},{children:e.jsxRuntimeExports.jsx(S.default,{appType:A,storeId:k,messageSource:_,sourceIntent:null!==(N=_.intent)&&void 0!==N?N:M.GENERIC,faqCount:de,trainingSourceCount:pe,ShowTrainingDataSource:Oe,ChecklistType:M,footerButtonOption:Q,isFooterLoading:ne,reasonForAiGeneratedResponse:X,showAiResponseReason:V,aiResponseLoading:J})})),!fe(te)&&e.jsxRuntimeExports.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Ce.length>0&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"info-product-source"},{children:e.jsxRuntimeExports.jsx(be,Object.assign({title:"Product Sources",count:Ce.length,isExpanded:A!==t.ApplicationType.MANIFEST||me,onToggle:()=>ge(!me)},{children:e.jsxRuntimeExports.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Ce.map(((t,s)=>{var i,o,n,r;const a=ve(t.type||t.subTitle||"OpenAI"),d=ve(t.type||t.subTitle||"OpenAI",!0),c=Se(a),x=null==W?void 0:W.includes(d),u=P[null!==(i=t.productId)&&void 0!==i?i:"Products"],j=t.title,m=t.productId&&(null==z?void 0:z[t.productId]),g=m&&m.metafield.join(", ");return e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Ce?void 0:Ce.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Te(a),e.jsxRuntimeExports.jsx(f.Tooltip,Object.assign({body:j,placement:"top"},{children:e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({style:d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:j}))}))]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==M.EMAIL_COLLECTION&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:c}))}),(t.link||t.docId)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:x?e.jsxRuntimeExports.jsx(E.IconButton,{Icon:l.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==u?void 0:u.onEditClick(u.data,u.type),disabled:!u,disabledTooltip:"This source is deleted"}):e.jsxRuntimeExports.jsx(E.IconButton,{Icon:p.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!u,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),m&&e.jsxRuntimeExports.jsxs(v.BodyCaption,{children:[e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;ue({title:j,description:Ie(m.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>ue(void 0)})}},{children:`${null===(o=m.description)||void 0===o?void 0:o.length} characters description,`})),e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>m.onEditFaqClick(m.faqs)},{children:`${null===(n=m.faqs)||void 0===n?void 0:n.length} FAQs, `})),e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsxRuntimeExports.jsx(f.Tooltip,Object.assign({body:g,placement:"top"},{children:e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(r=m.metafield)||void 0===r?void 0:r.length} metafields`}))}))]})]}),`info-${s}`)}))}))}))}))}),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Re.length>0&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"info-content-source"},{children:e.jsxRuntimeExports.jsx(be,Object.assign({title:"Content Sources",count:Re.length,isExpanded:A!==t.ApplicationType.MANIFEST||he,onToggle:()=>ye(!he)},{children:e.jsxRuntimeExports.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Re.map(((t,s)=>{var i,o,n,r,a,d,c,x,u,j,m,g,y,C,R,O,S;const T=ve(t.type||t.subTitle||"OpenAI"),I=ve(t.type||t.subTitle||"OpenAI",!0),b=Se(T),w=null==W?void 0:W.includes(I),D="Products"===t.subTitle?P[null!==(i=t.productId)&&void 0!==i?i:"Products"]:P[null!==(o=t.docId)&&void 0!==o?o:""],N=I.toLowerCase()===(null===(n=L.CustomDataType.FAQ)||void 0===n?void 0:n.toLowerCase())?"faq"===(null===(r=t.title)||void 0===r?void 0:r.toLowerCase())?t.subTitle:t.title:I.toLowerCase()===(null===(a=L.CustomDataType.FILES)||void 0===a?void 0:a.toLowerCase())||I.toLowerCase()===(null===(d=L.CustomDataType.FETCHED_LINKS)||void 0===d?void 0:d.toLowerCase())||I.toLowerCase()===(null===(c=L.CustomDataType.TEXTS)||void 0===c?void 0:c.toLowerCase())?t.title:I.toLowerCase()===(null===(x=L.CustomDataType.WEBSITE_LINKS)||void 0===x?void 0:x.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):t.intent===M.EMAIL_COLLECTION?b:t.title,A="faq"===I.toLowerCase()?null!==(m=null!==(u=null==D?void 0:D.content)&&void 0!==u?u:null===(j=null==D?void 0:D.data)||void 0===j?void 0:j.answer)&&void 0!==m?m:"":I.toLowerCase()===(null===(g=L.CustomDataType.FETCHED_LINKS)||void 0===g?void 0:g.toLowerCase())||I.toLowerCase()===(null===(y=L.CustomDataType.WEBSITE_LINKS)||void 0===y?void 0:y.toLowerCase())||I.toLowerCase()===(null===(C=L.CustomDataType.TEXTS)||void 0===C?void 0:C.toLowerCase())?null!==(S=null!==(R=null==D?void 0:D.content)&&void 0!==R?R:null===(O=null==D?void 0:D.data)||void 0===O?void 0:O.fileContentText)&&void 0!==S?S:"":t.intent===M.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Re?void 0:Re.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Te(T),e.jsxRuntimeExports.jsx(f.Tooltip,Object.assign({body:N,placement:"top"},{children:e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({style:I==L.CustomDataType.FETCHED_LINKS||I==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>I==L.CustomDataType.FETCHED_LINKS||I==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:N}))}))]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==M.EMAIL_COLLECTION&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:b}))}),(t.link||t.docId)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:w?e.jsxRuntimeExports.jsx(E.IconButton,{Icon:l.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==D?void 0:D.onEditClick(D.data,D.type),disabled:!D,disabledTooltip:"This source is deleted"}):e.jsxRuntimeExports.jsx(E.IconButton,{Icon:p.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!D,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),(null!=A?A:"").trim()&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:Ie(null!=A?A:"").trim()}))}))]}),`info-${s}`)}))}))}))}))})]}))]})}),xe&&e.jsxRuntimeExports.jsx(R.SideModal,Object.assign({header:"Product description",onClose:()=>ue(void 0),width:"30%"},{children:e.jsxRuntimeExports.jsx(b.DescriptionModal,{title:xe.title,description:xe.description,imageUrl:xe.imageUrl,onClose:xe.onClose})}))]})};
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import React from 'react';
3
3
  import { ICouponData } from "./type";
4
4
  import { Collection, Product } from "../product-picker/type";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth"),i=require("react"),o=require("./type.js");require("../dropdown/DropdownPopover/index.js");var n=require("../dropdown/Dropdown.js");require("../dropdown/ChipDropdown.js"),require("../zeroState/ZeroState.js");var l=require("../TypographyStyle.js"),r=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var s=require("../modals/styledModal.js"),a=require("../product-picker/ProductPickerModal.js"),d=require("../tag/Tag.js"),u=require("../tooltips/Tooltip.js"),c=require("../../assets/icons/gift_icon.svg.js"),p=require("../../assets/icons/percentage_icon.svg.js"),C=require("../../assets/icons/shipping_icon.svg.js"),E=require("../../assets/icons/triangle_error.svg.js"),T=require("../../assets/icons/warning.svg.js"),S=require("../product-picker-v2/modal.js");require("../product-picker-v2/type.js");var P=require("../variable-picker-v3/model.js"),I=require("../variable-picker-v3/VariablePicker.js"),O=require("./DiscountModal.styled.js"),v=require("./DiscountUtils.js"),_=require("./DynamicCoupon/DynamicCoupon.js"),b=require("./StaticCoupon/StaticCoupon.js");exports.DiscountModal=y=>{var m,x,D,N,h,j,R,f,U,A,g;const V=[{id:"0",label:"Amount",value:"amount",icon:t=>e.jsxRuntimeExports.jsx("span",Object.assign({style:{fontSize:20,color:t,lineHeight:.9}},{children:y.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:t=>e.jsxRuntimeExports.jsx(p.default,{width:24,height:24,color:t})},{id:"2",label:"Buy X get Y",value:o.DISCOUNT_TYPES.BUY_X_GET_Y,icon:t=>e.jsxRuntimeExports.jsx(c.default,{width:24,height:24,color:t})},{id:"3",label:"Free Shipping",value:o.DISCOUNT_TYPES.FREE_SHIPPING,icon:t=>e.jsxRuntimeExports.jsx(C.default,{width:24,height:24,color:t})}],[F,k]=i.useState(),[q,L]=i.useState(),[M,Y]=i.useState(),[w,G]=i.useState(null!==(m=y.data)&&void 0!==m?m:"string"==typeof y.hideOption?{isStaticCoupon:"dynamic"===y.hideOption}:{isStaticCoupon:!0}),[B,X]=i.useState(!0),[Q,H]=i.useState(),[z,K]=i.useState((null===(x=y.data)||void 0===x?void 0:x.minAmount)?o.MIN_PURCHASE_REQUIREMENT.AMOUNT:(null===(D=y.data)||void 0===D?void 0:D.minQuantity)?o.MIN_PURCHASE_REQUIREMENT.QUANTITY:o.MIN_PURCHASE_REQUIREMENT.NA),[$,Z]=i.useState(o.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),[J,W]=i.useState(o.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[ee,te]=i.useState(o.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[ie,oe]=i.useState(void 0),[ne,le]=i.useState(void 0),[re,se]=i.useState(void 0),[ae,de]=i.useState(void 0),[ue,ce]=i.useState(void 0),[pe,Ce]=i.useState(void 0),[Ee,Te]=i.useState(0),[Se,Pe]=i.useState(""),[Ie,Oe]=i.useState(V[0]),[ve,_e]=i.useState(!1),[be,ye]=i.useState(o.initialStaticCouponErrorState),[me,xe]=i.useState(o.initialDynamicCouponErrorState),[De,Ne]=i.useState(o.COUPON_EXPIRATION.DYNAMIC_EXPIRATION),he=[{value:o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:Q===o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:Q===o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:o.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:Q===o.DISCOUNT_TYPES.BUY_X_GET_Y},{value:o.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:Q===o.DISCOUNT_TYPES.FREE_SHIPPING}];i.useEffect((()=>{y.makeExpiryMandatory&&_e(!0)}),[y.makeExpiryMandatory]),i.useEffect((()=>{var e,t,i,n,l,r,s,a;let d;const{tempCouponData:u,discountType:c}=je();H(c);const p=(e,t)=>{Oe(u.valueType===o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?V[e]:V[t])},C=(e,t)=>{Object.keys(e||{}).length&&t(e)};switch(((null==u?void 0:u.expireAfter)||(null==u?void 0:u.expireAt))&&(_e(!0),(null==u?void 0:u.expireAt)&&Ne(o.COUPON_EXPIRATION.FIXED_EXPIRATION),(null==u?void 0:u.expireAfter)&&Ne(o.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)),c){case o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:p(0,1),Z(o.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:p(0,1),(null===(e=u.entitledCollectionIds)||void 0===e?void 0:e.length)?Z(o.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS):(null===(t=u.entitledProductIds)||void 0===t?void 0:t.length)||(null===(i=u.productVariableConf)||void 0===i?void 0:i.entitledProductVariable)?(Z(o.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(n=u.productVariableConf)||void 0===n?void 0:n.entitledProductVariable,de)):Z(o.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case o.DISCOUNT_TYPES.BUY_X_GET_Y:Oe(V[2]),(null===(l=u.entitledCollectionIds)||void 0===l?void 0:l.length)?te(o.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(te(o.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(r=u.productVariableConf)||void 0===r?void 0:r.entitledProductVariable,de)),(null===(s=u.prerequisiteCollectionIds)||void 0===s?void 0:s.length)?W(o.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(W(o.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(a=u.productVariableConf)||void 0===a?void 0:a.prerequisiteProductVariable,ce));break;case o.DISCOUNT_TYPES.FREE_SHIPPING:Oe(V[3])}G(Object.assign({},u)),y.hideProbability||(d=Ue()),X(v.validateDiscountData(u,z,c,y.hideProbability||!1,d,!!u.isStaticCoupon)),y.hideProbability||Ue()}),[]),i.useEffect((()=>{let e;y.hideProbability||(e=Ue()),X(v.validateDiscountData(w,z,Q,y.hideProbability||!1,e,!!w.isStaticCoupon))}),[w,Ee,Q,z]),i.useEffect((()=>{var e,t,i,o,n,l,r;if(!y.newPickerConf&&((null===(e=y.products)||void 0===e?void 0:e.length)||(null===(t=y.collection)||void 0===t?void 0:t.length))){if(y.products&&(null===(i=y.products)||void 0===i?void 0:i.length)){if(null===(o=y.data)||void 0===o?void 0:o.entitledProductIds){const e=y.products.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.entitledProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));le(e)}if(null===(n=y.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=y.products.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));oe(e)}}if(y.collection&&y.collection.length){if(null===(l=y.data)||void 0===l?void 0:l.entitledCollectionIds){const e=y.collection.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));Ce(e)}if(null===(r=y.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=y.collection.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));se(e)}}}}),[y.products,y.collection]),i.useEffect((()=>{var e,t,i,o,n,l,r,s;(null===(t=null===(e=y.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&le(y.data.productsConf.entitledProducts),(null===(o=null===(i=y.data)||void 0===i?void 0:i.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&oe(y.data.productsConf.prerequisiteProducts),(null===(l=null===(n=y.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&Ce(y.data.collectionsConf.entitledCollections),(null===(s=null===(r=y.data)||void 0===r?void 0:r.collectionsConf)||void 0===s?void 0:s.prerequisiteCollections)&&se(y.data.collectionsConf.prerequisiteCollections)}),[null===(N=y.data)||void 0===N?void 0:N.productsConf,null===(h=y.data)||void 0===h?void 0:h.collectionsConf]),i.useEffect((()=>{if(!ne)return;if(y.newPickerConf){const e=[];return Object.values(ne).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},w),{entitledProductIds:e}))}const e=ne.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{entitledProductIds:e}))}),[ne]),i.useEffect((()=>{if(!ie)return;if(y.newPickerConf){const e=[];return Object.values(ie).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},w),{prerequisiteProductIds:e}))}const e=ie.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{prerequisiteProductIds:e}))}),[ie]),i.useEffect((()=>{if(!pe)return;if(y.newPickerConf){(null==pe?void 0:pe.isCustom)&&delete pe.isCustom;const e=Object.keys(pe).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},w),{entitledCollectionIds:e}))}const e=pe.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{entitledCollectionIds:e}))}),[pe]),i.useEffect((()=>{if(!re)return;if(y.newPickerConf){(null==re?void 0:re.isCustom)&&delete re.isCustom;const e=Object.keys(re).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},w),{prerequisiteCollectionIds:e}))}const e=re.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{prerequisiteCollectionIds:e}))}),[re]);const je=()=>{var e,t;let i,n=w;return w.isStaticCoupon||(w.targetType===o.DISCOUNT_TARGET_TYPES.SHIPPING_LINE?i=o.DISCOUNT_TYPES.FREE_SHIPPING:w.targetType===o.DISCOUNT_TARGET_TYPES.LINE_ITEM?i=w.targetSelection===o.DISCOUNT_TARGET_SELECTION.ENTITLED?(null===(e=w.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=w.prerequisiteCollectionIds)||void 0===t?void 0:t.length)||w.prerequisiteQuantity||w.entitledQuantity?o.DISCOUNT_TYPES.BUY_X_GET_Y:o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:(n=Object.assign(Object.assign({},n),{targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,valueType:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),i=o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)),{discountType:i,tempCouponData:n}},Re=()=>{ye(o.initialStaticCouponErrorState),xe(o.initialDynamicCouponErrorState)},fe=e=>{var t;const i={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(t=w.probability)&&void 0!==t?t:-1)>1?"Probability should not exceed 1":w.isStaticCoupon?"Please add Probability":"Probability should be greater than 0",inValidDiscountAmount:"Please add Discount Amount",inValidMinimumAmount:"Specify minimum amount required",inValidMinimumQuantity:"Specify minimum items required",inValidCouponExpiry:"Please add Coupon Expiry",inValidProductSelection:"Please specify the products",inValidProductVariableSelection:"Please specify the product variables",inValidCollectionSelection:"Please specify the collections",inValidBuyXValue:"Please specify buy product quantity",inValidGetYValue:"Please specify get product quantity",inValidBuyXProductSelection:"Please specify the products",inValidBuyXCollectionSelection:"Please specify the collections",inValidGetYProductSelection:"Please specify the products",inValidGetYCollectionSelection:"Please specify the collections",inValidBuyXProductVariableSelection:"Please specify the product variables",inValidGetYProductVariableSelection:"Please specify the product variables"};let o="";Object.keys(e).forEach((t=>{e[t]&&(o=i[t])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(Pe(n>1?"Please add discount details":o),!0)},Ue=()=>{if(!y.quadrant||!y.probability)return;const e=[...y.probability];let t=[];e.length>=y.quadrant&&e.splice(y.quadrant-1,1),t=e;const i=t.reduce(((e,t)=>e+t),0)+(w.probability||0);return Te(parseFloat(i.toFixed(4))),parseFloat(i.toFixed(4))},Ae=e=>{var t,i,n,l,r,s,a,d,u,c,p,C,E,T,S,P;const I=e.value;H(I),oe([]),le([]),se([]),Ce([]),I===o.DISCOUNT_TYPES.FREE_SHIPPING?G({value:100,targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,targetType:o.DISCOUNT_TARGET_TYPES.SHIPPING_LINE,valueType:o.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(t=w.expireAt)&&void 0!==t?t:void 0,expireAfter:null!==(i=w.expireAfter)&&void 0!==i?i:void 0,probability:w.probability,minQuantity:null!==(n=w.minQuantity)&&void 0!==n?n:void 0,minAmount:null!==(l=w.minAmount)&&void 0!==l?l:void 0}):I===o.DISCOUNT_TYPES.BUY_X_GET_Y?G({value:100,targetSelection:o.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:o.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(r=w.expireAt)&&void 0!==r?r:void 0,expireAfter:null!==(s=w.expireAfter)&&void 0!==s?s:void 0,probability:w.probability,minQuantity:void 0,minAmount:void 0}):I===o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER?G({targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(a=w.valueType)&&void 0!==a?a:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(d=w.expireAt)&&void 0!==d?d:void 0,expireAfter:null!==(u=w.expireAfter)&&void 0!==u?u:void 0,probability:w.probability,value:w.value,minQuantity:null!==(c=w.minQuantity)&&void 0!==c?c:void 0,minAmount:null!==(p=w.minAmount)&&void 0!==p?p:void 0}):I===o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&G({targetSelection:o.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(C=w.valueType)&&void 0!==C?C:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(E=w.expireAt)&&void 0!==E?E:void 0,expireAfter:null!==(T=w.expireAfter)&&void 0!==T?T:void 0,probability:w.probability,value:w.value,minQuantity:null!==(S=w.minQuantity)&&void 0!==S?S:void 0,minAmount:null!==(P=w.minAmount)&&void 0!==P?P:void 0})},ge=t=>t&&e.jsxRuntimeExports.jsx(d.Tag,{theme:"light",tagText:t,type:"negative",LeadingIcon:T.default});return e.jsxRuntimeExports.jsxs(s.StyledModal,Object.assign({width:(M||F)&&y.newPickerConf?"25px":"640px",open:y.isOpen,hideCrossButton:!!q,headingTitle:F?"Select Products":y.title,headingSubtitle:F?void 0:y.subTitle,footerLeftCustomElement:Se?ge(Se):y.errorMsg?ge(y.errorMsg):!y.quadrant||y.hideProbability?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):Ee<=1?e.jsxRuntimeExports.jsx(d.Tag,{theme:"light",tagText:`Current probability sum: ${Ee}`,type:"white"}):e.jsxRuntimeExports.jsx(u.Tooltip,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(d.Tag,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${Ee}`,type:"negative",LeadingIcon:E.default})})})),headerRightCustomElement:y.allowStaticCoupon||F?void 0:e.jsxRuntimeExports.jsx(n.Dropdown,{options:he,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{Ae(e)}}),onClose:y.onClose,footerContainerStyle:{borderTop:`1px solid ${r.DEFAULT_THEME.colorsV2.stroke.primary}`},primaryButton:F?{buttonType:"primary",onClick:()=>{k(void 0)},buttonText:"Add"}:M?{buttonType:"primary",onClick:()=>{Y(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(j=y.loading)&&void 0!==j&&j,onClick:()=>{var e,t,i,n,l;if(Re(),w.isStaticCoupon){const{isStaticCoupon:e,couponCode:t,title:i,description:o,quadrant:n,probability:l}=w,r={invalidDiscountCode:!t,invalidCouponTitle:!i,invalidCouponDescription:!o,inValidProbability:!y.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(fe(r))return void ye(r);if(B||Ee>1)return void Pe(!y.hideProbability&&Ee>1?"Probability sum should not exceed 1":"Invalid coupon details");y.onSaveClicked({quadrant:n,couponCode:t,description:o,isStaticCoupon:e,probability:l,title:w.title})}else{const r={invalidCouponTitle:!w.title,inValidProbability:!y.hideProbability&&(null!==(e=w.probability)&&void 0!==e?e:-1)<=0||(null!==(t=w.probability)&&void 0!==t?t:-1)>1||Number.isNaN(null!==(i=w.probability)&&void 0!==i?i:-1),inValidDiscountAmount:!w.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(Q!==o.DISCOUNT_TYPES.BUY_X_GET_Y&&z!==o.MIN_PURCHASE_REQUIREMENT.NA){const{minAmount:e,minQuantity:t}=w;r.inValidMinimumAmount=z===o.MIN_PURCHASE_REQUIREMENT.AMOUNT&&!e,r.inValidMinimumQuantity=z===o.MIN_PURCHASE_REQUIREMENT.QUANTITY&&!t}if(ve&&(r.inValidCouponExpiry=!w.expireAt&&!w.expireAfter),Q!==o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER&&Q!==o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||($!==o.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||!ne||Object.keys(ne).length||ae||(r.inValidProductSelection=!0,r.inValidProductVariableSelection=!0),$===o.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&pe&&!Object.keys(pe).length&&(r.inValidCollectionSelection=!0)),Q===o.DISCOUNT_TYPES.BUY_X_GET_Y&&(w.prerequisiteQuantity||(r.inValidBuyXValue=!0),w.entitledQuantity||(r.inValidGetYValue=!0),J!==o.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!ie||Object.keys(ie).length||ue||(r.inValidBuyXProductSelection=!0,r.inValidBuyXProductVariableSelection=!0),J===o.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&re&&!Object.keys(re).length&&(r.inValidBuyXCollectionSelection=!0),ee!==o.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!ne||Object.keys(ne).length||ae||(r.inValidGetYProductSelection=!0,r.inValidGetYProductVariableSelection=!0),ee===o.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&pe&&!Object.keys(pe).length&&(r.inValidGetYCollectionSelection=!0)),fe(r))return void xe(r);if(B||Ee>1)return void Pe(!y.hideProbability&&Ee>1?"Probability sum should not exceed 1":"Invalid coupon details");y.onSaveClicked(Object.assign(Object.assign({},w),{description:v.descriptionBuilder(w,y.currency,null!==(n=y.products)&&void 0!==n?n:[],null!==(l=y.collection)&&void 0!==l?l:[]),productsConf:{entitledProducts:null!=ne?ne:[],prerequisiteProducts:null!=ie?ie:[]},collectionsConf:{entitledCollections:null!=pe?pe:[],prerequisiteCollections:null!=re?re:[]},productVariableConf:{entitledProductVariable:null!=ae?ae:{},prerequisiteProductVariable:null!=ue?ue:{}}}))}}},secondaryButton:F?{buttonType:"tertiaryGray",onClick:()=>{k(void 0)},buttonText:"Back"}:M?{buttonType:"tertiaryGray",onClick:()=>{Y(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:y.onClose,buttonText:"Cancel"}},{children:[!F&&!M&&e.jsxRuntimeExports.jsxs(O.StyledDiscountDialogueContainer,{children:[y.allowStaticCoupon&&!F&&e.jsxRuntimeExports.jsxs(O.CouponTypeContainerStyled,Object.assign({selectedDiv:w.isStaticCoupon?1:2},{children:["static"===y.hideOption?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{w.isStaticCoupon||(G({isStaticCoupon:!0,quadrant:w.quadrant}),Pe(""),Re())}},{children:[e.jsxRuntimeExports.jsx(l.TitleSmall,Object.assign({style:{marginBottom:"4px",color:w.isStaticCoupon?r.DEFAULT_THEME.colorsV2.content.brand:void 0}},{children:"Static Code"})),e.jsxRuntimeExports.jsx(l.BodyCaption,Object.assign({style:w.isStaticCoupon?{color:r.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===y.hideOption?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{var t;w.isStaticCoupon&&(H(o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER),G({isStaticCoupon:!1,quadrant:w.quadrant,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,valueType:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),Pe(""),Re(),Oe({id:"0",label:"Amount",value:"amount",icon:t=>e.jsxRuntimeExports.jsx("span",Object.assign({style:{fontSize:20,color:t}},{children:y.currency||""}))}),_e(null!==(t=y.makeExpiryMandatory)&&void 0!==t&&t),K(o.MIN_PURCHASE_REQUIREMENT.NA))}},{children:[e.jsxRuntimeExports.jsx(l.TitleSmall,Object.assign({style:{marginBottom:"4px",color:w.isStaticCoupon?void 0:r.DEFAULT_THEME.colorsV2.content.brand}},{children:"Dynamic Code"})),e.jsxRuntimeExports.jsx(l.BodyCaption,Object.assign({style:w.isStaticCoupon?{}:{color:r.DEFAULT_THEME.colorsV2.content.brand}},{children:"Code will be unique for all customers, with the first 5 letters of the customer's name, followed by 10 random characters."}))]}))]})),e.jsxRuntimeExports.jsx(l.TitleRegular,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"})),w.isStaticCoupon&&!F&&e.jsxRuntimeExports.jsx(b.default,{discountData:w,setDiscountData:G,hideProbability:y.hideProbability||!1,discountAdminUrl:y.discountAdminUrl,staticDiscountValidationError:be,currency:y.currency}),!w.isStaticCoupon&&!F&&!M&&e.jsxRuntimeExports.jsx(_.default,{currency:y.currency,entitledProducts:null!=ne?ne:[],prerequisiteProducts:null!=ie?ie:[],setEntitledProducts:le,setPrerequisiteProducts:oe,discountData:w,productPickerOpen:F,productVariablePickerOpen:q,setIsProductPickerOpen:k,setIsProductVariablePickerOpen:L,setDiscountData:G,selectedCouponType:Q,setSelectedCouponType:H,selectedMinimumRequirement:z,setSelectedMinimumRequirement:K,discountCouponAppliesTo:$,offerAppliesToBuy:J,offerAppliesToGet:ee,setDiscountCouponAppliesTo:Z,setOfferAppliesToBuy:W,setOfferAppliesToGet:te,hideProbability:y.hideProbability||!1,hideExpiration:y.hideExpiration||!1,allowStaticCoupon:y.allowStaticCoupon,onChangeCouponType:Ae,collectionPickerOpen:M,entitledCollections:null!=pe?pe:[],prerequisiteCollections:null!=re?re:[],setIsCollectionPickerOpen:Y,setEntitledCollections:Ce,setPrerequisiteCollections:se,useNewPicker:!!y.newPickerConf,setSelectedDiscountDetails:Oe,selectedDiscountDetails:Ie,isProductVariableSupported:y.isProductVariableSupported,entitledProductVariable:ae,setEntitledProductVariable:de,preRequisiteProductVariable:ue,setPreRequisiteProductVariable:ce,productVariableList:y.productVariableList,isAddExpirationChecked:ve,setIsAddExpirationChecked:_e,dynamicDiscountValidationError:me,setDynamicDiscountValidationError:xe,setValidationErrorMessage:Pe,resetValidationErrors:Re,discountDetailsOptions:V,selectedExpiration:De,setSelectedExpiration:Ne,makeExpiryMandatory:!!y.makeExpiryMandatory})]}),!!F&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[!y.newPickerConf&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsxRuntimeExports.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(R=y.products)&&void 0!==R?R:[],title:"Select Products",onClose:()=>{k(void 0)},selectedProducts:null!==(f=F===_.DISCOUNT_PRODUCTS.ENTITLED?ne:ie)&&void 0!==f?f:[],setSelectedProducts:F===_.DISCOUNT_PRODUCTS.ENTITLED?le:oe,onSearchKeyChange:y.onProductSearch})})),y.newPickerConf&&e.jsxRuntimeExports.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>k(void 0),collectionFetcher:(e,t,i)=>{var o;return(null===(o=y.newPickerConf)||void 0===o?void 0:o.fetchCollections)?y.newPickerConf.fetchCollections(e,t,!1,i):null},productFetcher:(e,t,i,o,n)=>{var l;return(null===(l=y.newPickerConf)||void 0===l?void 0:l.fetchProducts)?y.newPickerConf.fetchProducts(e,t,o,n,!1,i):null},selectedItems:F===_.DISCOUNT_PRODUCTS.ENTITLED?ne:ie,onAdd:e=>{F===_.DISCOUNT_PRODUCTS.ENTITLED?le(e):oe(e),k(void 0)},zIndex:200,storeId:y.newPickerConf.storeId,appType:y.newPickerConf.appType||t.ApplicationType.BIK,searchInCollectionFetcher:(e,t,i,o)=>{var n;return(null===(n=y.newPickerConf)||void 0===n?void 0:n.searchInCollection)?y.newPickerConf.searchInCollection(e,t,i,!1,o):null},customCollectionRestriction:!1,searchFetcher:(e,t,i)=>{var o;return(null===(o=y.newPickerConf)||void 0===o?void 0:o.searchProducts)?y.newPickerConf.searchProducts(e,t,!1,i):null},hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!M&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[y.newPickerConf&&e.jsxRuntimeExports.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>Y(void 0),collectionFetcher:y.newPickerConf.fetchCollections,productFetcher:y.newPickerConf.fetchProducts,selectedItems:M===_.DISCOUNT_PRODUCTS.ENTITLED?pe:re,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),M===_.DISCOUNT_PRODUCTS.ENTITLED?Ce(e):se(e),Y(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:y.newPickerConf.storeId,appType:y.newPickerConf.appType||t.ApplicationType.BIK,searchInCollectionFetcher:y.newPickerConf.searchInCollection,searchFetcher:y.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!y.newPickerConf&&e.jsxRuntimeExports.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(U=y.collection)&&void 0!==U?U:[],title:"Select Products",onClose:()=>{Y(void 0)},selectedProducts:null!==(A=M===_.DISCOUNT_PRODUCTS.ENTITLED?pe:re)&&void 0!==A?A:[],setSelectedProducts:M===_.DISCOUNT_PRODUCTS.ENTITLED?Ce:se,onSearchKeyChange:y.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),q&&e.jsxRuntimeExports.jsx(O.VariablePickerContainer,{children:e.jsxRuntimeExports.jsx("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e.jsxRuntimeExports.jsx(I.VariablePicker,{type:P.PickerType.EMBEDDED,data:null!==(g=y.productVariableList)&&void 0!==g?g:[],showHeader:!0,onSelect:e=>{if(q===_.DISCOUNT_PRODUCTS.ENTITLED){const{displayName:t,actualValue:i,isAvailable:o}=e;de({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}if(q===_.DISCOUNT_PRODUCTS.PREREQUISITE){const{displayName:t,actualValue:i,isAvailable:o}=e;ce({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}},onClose:()=>{L(void 0)}})}))})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth/models/bik-store"),i=require("react"),o=require("./type.js");require("../dropdown/DropdownPopover/index.js");var n=require("../dropdown/Dropdown.js");require("../dropdown/ChipDropdown.js"),require("../zeroState/ZeroState.js");var l=require("../TypographyStyle.js"),r=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var s=require("../modals/styledModal.js"),a=require("../product-picker/ProductPickerModal.js"),d=require("../tag/Tag.js"),u=require("../tooltips/Tooltip.js"),c=require("../../assets/icons/gift_icon.svg.js"),p=require("../../assets/icons/percentage_icon.svg.js"),C=require("../../assets/icons/shipping_icon.svg.js"),E=require("../../assets/icons/triangle_error.svg.js"),T=require("../../assets/icons/warning.svg.js"),S=require("../product-picker-v2/modal.js");require("../product-picker-v2/type.js");var P=require("../variable-picker-v3/model.js"),I=require("../variable-picker-v3/VariablePicker.js"),O=require("./DiscountModal.styled.js"),v=require("./DiscountUtils.js"),_=require("./DynamicCoupon/DynamicCoupon.js"),b=require("./StaticCoupon/StaticCoupon.js");exports.DiscountModal=y=>{var m,x,D,N,h,j,R,f,U,A,g;const V=[{id:"0",label:"Amount",value:"amount",icon:t=>e.jsxRuntimeExports.jsx("span",Object.assign({style:{fontSize:20,color:t,lineHeight:.9}},{children:y.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:t=>e.jsxRuntimeExports.jsx(p.default,{width:24,height:24,color:t})},{id:"2",label:"Buy X get Y",value:o.DISCOUNT_TYPES.BUY_X_GET_Y,icon:t=>e.jsxRuntimeExports.jsx(c.default,{width:24,height:24,color:t})},{id:"3",label:"Free Shipping",value:o.DISCOUNT_TYPES.FREE_SHIPPING,icon:t=>e.jsxRuntimeExports.jsx(C.default,{width:24,height:24,color:t})}],[F,k]=i.useState(),[q,L]=i.useState(),[M,Y]=i.useState(),[w,G]=i.useState(null!==(m=y.data)&&void 0!==m?m:"string"==typeof y.hideOption?{isStaticCoupon:"dynamic"===y.hideOption}:{isStaticCoupon:!0}),[B,X]=i.useState(!0),[Q,H]=i.useState(),[z,K]=i.useState((null===(x=y.data)||void 0===x?void 0:x.minAmount)?o.MIN_PURCHASE_REQUIREMENT.AMOUNT:(null===(D=y.data)||void 0===D?void 0:D.minQuantity)?o.MIN_PURCHASE_REQUIREMENT.QUANTITY:o.MIN_PURCHASE_REQUIREMENT.NA),[$,Z]=i.useState(o.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),[J,W]=i.useState(o.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[ee,te]=i.useState(o.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[ie,oe]=i.useState(void 0),[ne,le]=i.useState(void 0),[re,se]=i.useState(void 0),[ae,de]=i.useState(void 0),[ue,ce]=i.useState(void 0),[pe,Ce]=i.useState(void 0),[Ee,Te]=i.useState(0),[Se,Pe]=i.useState(""),[Ie,Oe]=i.useState(V[0]),[ve,_e]=i.useState(!1),[be,ye]=i.useState(o.initialStaticCouponErrorState),[me,xe]=i.useState(o.initialDynamicCouponErrorState),[De,Ne]=i.useState(o.COUPON_EXPIRATION.DYNAMIC_EXPIRATION),he=[{value:o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:Q===o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:Q===o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:o.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:Q===o.DISCOUNT_TYPES.BUY_X_GET_Y},{value:o.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:Q===o.DISCOUNT_TYPES.FREE_SHIPPING}];i.useEffect((()=>{y.makeExpiryMandatory&&_e(!0)}),[y.makeExpiryMandatory]),i.useEffect((()=>{var e,t,i,n,l,r,s,a;let d;const{tempCouponData:u,discountType:c}=je();H(c);const p=(e,t)=>{Oe(u.valueType===o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?V[e]:V[t])},C=(e,t)=>{Object.keys(e||{}).length&&t(e)};switch(((null==u?void 0:u.expireAfter)||(null==u?void 0:u.expireAt))&&(_e(!0),(null==u?void 0:u.expireAt)&&Ne(o.COUPON_EXPIRATION.FIXED_EXPIRATION),(null==u?void 0:u.expireAfter)&&Ne(o.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)),c){case o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:p(0,1),Z(o.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:p(0,1),(null===(e=u.entitledCollectionIds)||void 0===e?void 0:e.length)?Z(o.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS):(null===(t=u.entitledProductIds)||void 0===t?void 0:t.length)||(null===(i=u.productVariableConf)||void 0===i?void 0:i.entitledProductVariable)?(Z(o.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(n=u.productVariableConf)||void 0===n?void 0:n.entitledProductVariable,de)):Z(o.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case o.DISCOUNT_TYPES.BUY_X_GET_Y:Oe(V[2]),(null===(l=u.entitledCollectionIds)||void 0===l?void 0:l.length)?te(o.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(te(o.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(r=u.productVariableConf)||void 0===r?void 0:r.entitledProductVariable,de)),(null===(s=u.prerequisiteCollectionIds)||void 0===s?void 0:s.length)?W(o.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(W(o.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(a=u.productVariableConf)||void 0===a?void 0:a.prerequisiteProductVariable,ce));break;case o.DISCOUNT_TYPES.FREE_SHIPPING:Oe(V[3])}G(Object.assign({},u)),y.hideProbability||(d=Ue()),X(v.validateDiscountData(u,z,c,y.hideProbability||!1,d,!!u.isStaticCoupon)),y.hideProbability||Ue()}),[]),i.useEffect((()=>{let e;y.hideProbability||(e=Ue()),X(v.validateDiscountData(w,z,Q,y.hideProbability||!1,e,!!w.isStaticCoupon))}),[w,Ee,Q,z]),i.useEffect((()=>{var e,t,i,o,n,l,r;if(!y.newPickerConf&&((null===(e=y.products)||void 0===e?void 0:e.length)||(null===(t=y.collection)||void 0===t?void 0:t.length))){if(y.products&&(null===(i=y.products)||void 0===i?void 0:i.length)){if(null===(o=y.data)||void 0===o?void 0:o.entitledProductIds){const e=y.products.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.entitledProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));le(e)}if(null===(n=y.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=y.products.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));oe(e)}}if(y.collection&&y.collection.length){if(null===(l=y.data)||void 0===l?void 0:l.entitledCollectionIds){const e=y.collection.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));Ce(e)}if(null===(r=y.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=y.collection.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));se(e)}}}}),[y.products,y.collection]),i.useEffect((()=>{var e,t,i,o,n,l,r,s;(null===(t=null===(e=y.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&le(y.data.productsConf.entitledProducts),(null===(o=null===(i=y.data)||void 0===i?void 0:i.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&oe(y.data.productsConf.prerequisiteProducts),(null===(l=null===(n=y.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&Ce(y.data.collectionsConf.entitledCollections),(null===(s=null===(r=y.data)||void 0===r?void 0:r.collectionsConf)||void 0===s?void 0:s.prerequisiteCollections)&&se(y.data.collectionsConf.prerequisiteCollections)}),[null===(N=y.data)||void 0===N?void 0:N.productsConf,null===(h=y.data)||void 0===h?void 0:h.collectionsConf]),i.useEffect((()=>{if(!ne)return;if(y.newPickerConf){const e=[];return Object.values(ne).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},w),{entitledProductIds:e}))}const e=ne.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{entitledProductIds:e}))}),[ne]),i.useEffect((()=>{if(!ie)return;if(y.newPickerConf){const e=[];return Object.values(ie).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},w),{prerequisiteProductIds:e}))}const e=ie.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{prerequisiteProductIds:e}))}),[ie]),i.useEffect((()=>{if(!pe)return;if(y.newPickerConf){(null==pe?void 0:pe.isCustom)&&delete pe.isCustom;const e=Object.keys(pe).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},w),{entitledCollectionIds:e}))}const e=pe.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{entitledCollectionIds:e}))}),[pe]),i.useEffect((()=>{if(!re)return;if(y.newPickerConf){(null==re?void 0:re.isCustom)&&delete re.isCustom;const e=Object.keys(re).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},w),{prerequisiteCollectionIds:e}))}const e=re.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{prerequisiteCollectionIds:e}))}),[re]);const je=()=>{var e,t;let i,n=w;return w.isStaticCoupon||(w.targetType===o.DISCOUNT_TARGET_TYPES.SHIPPING_LINE?i=o.DISCOUNT_TYPES.FREE_SHIPPING:w.targetType===o.DISCOUNT_TARGET_TYPES.LINE_ITEM?i=w.targetSelection===o.DISCOUNT_TARGET_SELECTION.ENTITLED?(null===(e=w.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=w.prerequisiteCollectionIds)||void 0===t?void 0:t.length)||w.prerequisiteQuantity||w.entitledQuantity?o.DISCOUNT_TYPES.BUY_X_GET_Y:o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:(n=Object.assign(Object.assign({},n),{targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,valueType:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),i=o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)),{discountType:i,tempCouponData:n}},Re=()=>{ye(o.initialStaticCouponErrorState),xe(o.initialDynamicCouponErrorState)},fe=e=>{var t;const i={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(t=w.probability)&&void 0!==t?t:-1)>1?"Probability should not exceed 1":w.isStaticCoupon?"Please add Probability":"Probability should be greater than 0",inValidDiscountAmount:"Please add Discount Amount",inValidMinimumAmount:"Specify minimum amount required",inValidMinimumQuantity:"Specify minimum items required",inValidCouponExpiry:"Please add Coupon Expiry",inValidProductSelection:"Please specify the products",inValidProductVariableSelection:"Please specify the product variables",inValidCollectionSelection:"Please specify the collections",inValidBuyXValue:"Please specify buy product quantity",inValidGetYValue:"Please specify get product quantity",inValidBuyXProductSelection:"Please specify the products",inValidBuyXCollectionSelection:"Please specify the collections",inValidGetYProductSelection:"Please specify the products",inValidGetYCollectionSelection:"Please specify the collections",inValidBuyXProductVariableSelection:"Please specify the product variables",inValidGetYProductVariableSelection:"Please specify the product variables"};let o="";Object.keys(e).forEach((t=>{e[t]&&(o=i[t])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(Pe(n>1?"Please add discount details":o),!0)},Ue=()=>{if(!y.quadrant||!y.probability)return;const e=[...y.probability];let t=[];e.length>=y.quadrant&&e.splice(y.quadrant-1,1),t=e;const i=t.reduce(((e,t)=>e+t),0)+(w.probability||0);return Te(parseFloat(i.toFixed(4))),parseFloat(i.toFixed(4))},Ae=e=>{var t,i,n,l,r,s,a,d,u,c,p,C,E,T,S,P;const I=e.value;H(I),oe([]),le([]),se([]),Ce([]),I===o.DISCOUNT_TYPES.FREE_SHIPPING?G({value:100,targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,targetType:o.DISCOUNT_TARGET_TYPES.SHIPPING_LINE,valueType:o.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(t=w.expireAt)&&void 0!==t?t:void 0,expireAfter:null!==(i=w.expireAfter)&&void 0!==i?i:void 0,probability:w.probability,minQuantity:null!==(n=w.minQuantity)&&void 0!==n?n:void 0,minAmount:null!==(l=w.minAmount)&&void 0!==l?l:void 0}):I===o.DISCOUNT_TYPES.BUY_X_GET_Y?G({value:100,targetSelection:o.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:o.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(r=w.expireAt)&&void 0!==r?r:void 0,expireAfter:null!==(s=w.expireAfter)&&void 0!==s?s:void 0,probability:w.probability,minQuantity:void 0,minAmount:void 0}):I===o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER?G({targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(a=w.valueType)&&void 0!==a?a:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(d=w.expireAt)&&void 0!==d?d:void 0,expireAfter:null!==(u=w.expireAfter)&&void 0!==u?u:void 0,probability:w.probability,value:w.value,minQuantity:null!==(c=w.minQuantity)&&void 0!==c?c:void 0,minAmount:null!==(p=w.minAmount)&&void 0!==p?p:void 0}):I===o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&G({targetSelection:o.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(C=w.valueType)&&void 0!==C?C:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(E=w.expireAt)&&void 0!==E?E:void 0,expireAfter:null!==(T=w.expireAfter)&&void 0!==T?T:void 0,probability:w.probability,value:w.value,minQuantity:null!==(S=w.minQuantity)&&void 0!==S?S:void 0,minAmount:null!==(P=w.minAmount)&&void 0!==P?P:void 0})},ge=t=>t&&e.jsxRuntimeExports.jsx(d.Tag,{theme:"light",tagText:t,type:"negative",LeadingIcon:T.default});return e.jsxRuntimeExports.jsxs(s.StyledModal,Object.assign({width:(M||F)&&y.newPickerConf?"25px":"640px",open:y.isOpen,hideCrossButton:!!q,headingTitle:F?"Select Products":y.title,headingSubtitle:F?void 0:y.subTitle,footerLeftCustomElement:Se?ge(Se):y.errorMsg?ge(y.errorMsg):!y.quadrant||y.hideProbability?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):Ee<=1?e.jsxRuntimeExports.jsx(d.Tag,{theme:"light",tagText:`Current probability sum: ${Ee}`,type:"white"}):e.jsxRuntimeExports.jsx(u.Tooltip,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(d.Tag,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${Ee}`,type:"negative",LeadingIcon:E.default})})})),headerRightCustomElement:y.allowStaticCoupon||F?void 0:e.jsxRuntimeExports.jsx(n.Dropdown,{options:he,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{Ae(e)}}),onClose:y.onClose,footerContainerStyle:{borderTop:`1px solid ${r.DEFAULT_THEME.colorsV2.stroke.primary}`},primaryButton:F?{buttonType:"primary",onClick:()=>{k(void 0)},buttonText:"Add"}:M?{buttonType:"primary",onClick:()=>{Y(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(j=y.loading)&&void 0!==j&&j,onClick:()=>{var e,t,i,n,l;if(Re(),w.isStaticCoupon){const{isStaticCoupon:e,couponCode:t,title:i,description:o,quadrant:n,probability:l}=w,r={invalidDiscountCode:!t,invalidCouponTitle:!i,invalidCouponDescription:!o,inValidProbability:!y.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(fe(r))return void ye(r);if(B||Ee>1)return void Pe(!y.hideProbability&&Ee>1?"Probability sum should not exceed 1":"Invalid coupon details");y.onSaveClicked({quadrant:n,couponCode:t,description:o,isStaticCoupon:e,probability:l,title:w.title})}else{const r={invalidCouponTitle:!w.title,inValidProbability:!y.hideProbability&&(null!==(e=w.probability)&&void 0!==e?e:-1)<=0||(null!==(t=w.probability)&&void 0!==t?t:-1)>1||Number.isNaN(null!==(i=w.probability)&&void 0!==i?i:-1),inValidDiscountAmount:!w.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(Q!==o.DISCOUNT_TYPES.BUY_X_GET_Y&&z!==o.MIN_PURCHASE_REQUIREMENT.NA){const{minAmount:e,minQuantity:t}=w;r.inValidMinimumAmount=z===o.MIN_PURCHASE_REQUIREMENT.AMOUNT&&!e,r.inValidMinimumQuantity=z===o.MIN_PURCHASE_REQUIREMENT.QUANTITY&&!t}if(ve&&(r.inValidCouponExpiry=!w.expireAt&&!w.expireAfter),Q!==o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER&&Q!==o.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||($!==o.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||!ne||Object.keys(ne).length||ae||(r.inValidProductSelection=!0,r.inValidProductVariableSelection=!0),$===o.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&pe&&!Object.keys(pe).length&&(r.inValidCollectionSelection=!0)),Q===o.DISCOUNT_TYPES.BUY_X_GET_Y&&(w.prerequisiteQuantity||(r.inValidBuyXValue=!0),w.entitledQuantity||(r.inValidGetYValue=!0),J!==o.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!ie||Object.keys(ie).length||ue||(r.inValidBuyXProductSelection=!0,r.inValidBuyXProductVariableSelection=!0),J===o.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&re&&!Object.keys(re).length&&(r.inValidBuyXCollectionSelection=!0),ee!==o.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!ne||Object.keys(ne).length||ae||(r.inValidGetYProductSelection=!0,r.inValidGetYProductVariableSelection=!0),ee===o.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&pe&&!Object.keys(pe).length&&(r.inValidGetYCollectionSelection=!0)),fe(r))return void xe(r);if(B||Ee>1)return void Pe(!y.hideProbability&&Ee>1?"Probability sum should not exceed 1":"Invalid coupon details");y.onSaveClicked(Object.assign(Object.assign({},w),{description:v.descriptionBuilder(w,y.currency,null!==(n=y.products)&&void 0!==n?n:[],null!==(l=y.collection)&&void 0!==l?l:[]),productsConf:{entitledProducts:null!=ne?ne:[],prerequisiteProducts:null!=ie?ie:[]},collectionsConf:{entitledCollections:null!=pe?pe:[],prerequisiteCollections:null!=re?re:[]},productVariableConf:{entitledProductVariable:null!=ae?ae:{},prerequisiteProductVariable:null!=ue?ue:{}}}))}}},secondaryButton:F?{buttonType:"tertiaryGray",onClick:()=>{k(void 0)},buttonText:"Back"}:M?{buttonType:"tertiaryGray",onClick:()=>{Y(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:y.onClose,buttonText:"Cancel"}},{children:[!F&&!M&&e.jsxRuntimeExports.jsxs(O.StyledDiscountDialogueContainer,{children:[y.allowStaticCoupon&&!F&&e.jsxRuntimeExports.jsxs(O.CouponTypeContainerStyled,Object.assign({selectedDiv:w.isStaticCoupon?1:2},{children:["static"===y.hideOption?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{w.isStaticCoupon||(G({isStaticCoupon:!0,quadrant:w.quadrant}),Pe(""),Re())}},{children:[e.jsxRuntimeExports.jsx(l.TitleSmall,Object.assign({style:{marginBottom:"4px",color:w.isStaticCoupon?r.DEFAULT_THEME.colorsV2.content.brand:void 0}},{children:"Static Code"})),e.jsxRuntimeExports.jsx(l.BodyCaption,Object.assign({style:w.isStaticCoupon?{color:r.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===y.hideOption?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{var t;w.isStaticCoupon&&(H(o.DISCOUNT_TYPES.AMOUNT_OFF_ORDER),G({isStaticCoupon:!1,quadrant:w.quadrant,targetType:o.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:o.DISCOUNT_TARGET_SELECTION.ALL,valueType:o.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),Pe(""),Re(),Oe({id:"0",label:"Amount",value:"amount",icon:t=>e.jsxRuntimeExports.jsx("span",Object.assign({style:{fontSize:20,color:t}},{children:y.currency||""}))}),_e(null!==(t=y.makeExpiryMandatory)&&void 0!==t&&t),K(o.MIN_PURCHASE_REQUIREMENT.NA))}},{children:[e.jsxRuntimeExports.jsx(l.TitleSmall,Object.assign({style:{marginBottom:"4px",color:w.isStaticCoupon?void 0:r.DEFAULT_THEME.colorsV2.content.brand}},{children:"Dynamic Code"})),e.jsxRuntimeExports.jsx(l.BodyCaption,Object.assign({style:w.isStaticCoupon?{}:{color:r.DEFAULT_THEME.colorsV2.content.brand}},{children:"Code will be unique for all customers, with the first 5 letters of the customer's name, followed by 10 random characters."}))]}))]})),e.jsxRuntimeExports.jsx(l.TitleRegular,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"})),w.isStaticCoupon&&!F&&e.jsxRuntimeExports.jsx(b.default,{discountData:w,setDiscountData:G,hideProbability:y.hideProbability||!1,discountAdminUrl:y.discountAdminUrl,staticDiscountValidationError:be,currency:y.currency}),!w.isStaticCoupon&&!F&&!M&&e.jsxRuntimeExports.jsx(_.default,{currency:y.currency,entitledProducts:null!=ne?ne:[],prerequisiteProducts:null!=ie?ie:[],setEntitledProducts:le,setPrerequisiteProducts:oe,discountData:w,productPickerOpen:F,productVariablePickerOpen:q,setIsProductPickerOpen:k,setIsProductVariablePickerOpen:L,setDiscountData:G,selectedCouponType:Q,setSelectedCouponType:H,selectedMinimumRequirement:z,setSelectedMinimumRequirement:K,discountCouponAppliesTo:$,offerAppliesToBuy:J,offerAppliesToGet:ee,setDiscountCouponAppliesTo:Z,setOfferAppliesToBuy:W,setOfferAppliesToGet:te,hideProbability:y.hideProbability||!1,hideExpiration:y.hideExpiration||!1,allowStaticCoupon:y.allowStaticCoupon,onChangeCouponType:Ae,collectionPickerOpen:M,entitledCollections:null!=pe?pe:[],prerequisiteCollections:null!=re?re:[],setIsCollectionPickerOpen:Y,setEntitledCollections:Ce,setPrerequisiteCollections:se,useNewPicker:!!y.newPickerConf,setSelectedDiscountDetails:Oe,selectedDiscountDetails:Ie,isProductVariableSupported:y.isProductVariableSupported,entitledProductVariable:ae,setEntitledProductVariable:de,preRequisiteProductVariable:ue,setPreRequisiteProductVariable:ce,productVariableList:y.productVariableList,isAddExpirationChecked:ve,setIsAddExpirationChecked:_e,dynamicDiscountValidationError:me,setDynamicDiscountValidationError:xe,setValidationErrorMessage:Pe,resetValidationErrors:Re,discountDetailsOptions:V,selectedExpiration:De,setSelectedExpiration:Ne,makeExpiryMandatory:!!y.makeExpiryMandatory})]}),!!F&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[!y.newPickerConf&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsxRuntimeExports.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(R=y.products)&&void 0!==R?R:[],title:"Select Products",onClose:()=>{k(void 0)},selectedProducts:null!==(f=F===_.DISCOUNT_PRODUCTS.ENTITLED?ne:ie)&&void 0!==f?f:[],setSelectedProducts:F===_.DISCOUNT_PRODUCTS.ENTITLED?le:oe,onSearchKeyChange:y.onProductSearch})})),y.newPickerConf&&e.jsxRuntimeExports.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>k(void 0),collectionFetcher:(e,t,i)=>{var o;return(null===(o=y.newPickerConf)||void 0===o?void 0:o.fetchCollections)?y.newPickerConf.fetchCollections(e,t,!1,i):null},productFetcher:(e,t,i,o,n)=>{var l;return(null===(l=y.newPickerConf)||void 0===l?void 0:l.fetchProducts)?y.newPickerConf.fetchProducts(e,t,o,n,!1,i):null},selectedItems:F===_.DISCOUNT_PRODUCTS.ENTITLED?ne:ie,onAdd:e=>{F===_.DISCOUNT_PRODUCTS.ENTITLED?le(e):oe(e),k(void 0)},zIndex:200,storeId:y.newPickerConf.storeId,appType:y.newPickerConf.appType||t.ApplicationType.BIK,searchInCollectionFetcher:(e,t,i,o)=>{var n;return(null===(n=y.newPickerConf)||void 0===n?void 0:n.searchInCollection)?y.newPickerConf.searchInCollection(e,t,i,!1,o):null},customCollectionRestriction:!1,searchFetcher:(e,t,i)=>{var o;return(null===(o=y.newPickerConf)||void 0===o?void 0:o.searchProducts)?y.newPickerConf.searchProducts(e,t,!1,i):null},hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!M&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[y.newPickerConf&&e.jsxRuntimeExports.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>Y(void 0),collectionFetcher:y.newPickerConf.fetchCollections,productFetcher:y.newPickerConf.fetchProducts,selectedItems:M===_.DISCOUNT_PRODUCTS.ENTITLED?pe:re,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),M===_.DISCOUNT_PRODUCTS.ENTITLED?Ce(e):se(e),Y(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:y.newPickerConf.storeId,appType:y.newPickerConf.appType||t.ApplicationType.BIK,searchInCollectionFetcher:y.newPickerConf.searchInCollection,searchFetcher:y.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!y.newPickerConf&&e.jsxRuntimeExports.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(U=y.collection)&&void 0!==U?U:[],title:"Select Products",onClose:()=>{Y(void 0)},selectedProducts:null!==(A=M===_.DISCOUNT_PRODUCTS.ENTITLED?pe:re)&&void 0!==A?A:[],setSelectedProducts:M===_.DISCOUNT_PRODUCTS.ENTITLED?Ce:se,onSearchKeyChange:y.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),q&&e.jsxRuntimeExports.jsx(O.VariablePickerContainer,{children:e.jsxRuntimeExports.jsx("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e.jsxRuntimeExports.jsx(I.VariablePicker,{type:P.PickerType.EMBEDDED,data:null!==(g=y.productVariableList)&&void 0!==g?g:[],showHeader:!0,onSelect:e=>{if(q===_.DISCOUNT_PRODUCTS.ENTITLED){const{displayName:t,actualValue:i,isAvailable:o}=e;de({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}if(q===_.DISCOUNT_PRODUCTS.PREREQUISITE){const{displayName:t,actualValue:i,isAvailable:o}=e;ce({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}},onClose:()=>{L(void 0)}})}))})]}))};
@@ -1,6 +1,7 @@
1
1
  export declare const OverLapAbs: import("styled-components").StyledComponent<"div", any, {
2
2
  disabled?: boolean | undefined;
3
3
  allowEvents?: boolean | undefined;
4
+ isChildLoading?: boolean | undefined;
4
5
  }, never>;
5
6
  export declare const OpenDropdownContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
6
7
  export declare const LoadingContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=i(e);const o=r.default.div`
2
2
  position:
3
3
  // if allowEvents is true, then position is relative, else position is absolute
4
- ${e=>(null==e?void 0:e.allowEvents)?"relative":"absolute"};
4
+ ${e=>(null==e?void 0:e.allowEvents)||(null==e?void 0:e.isChildLoading)?"relative":"absolute"};
5
5
  left: 0px;
6
6
  top: 0px;
7
7
  width: 100%;
@@ -19,7 +19,7 @@
19
19
  background: ${t.COLORS.surface.hovered};
20
20
  border: 1px solid ${t.COLORS.stroke.primary};
21
21
  border-radius: 4px;
22
- `;const p=r.default.div`
22
+ `;const s=r.default.div`
23
23
  width: 360px;
24
24
  height: 100%;
25
25
  padding: 8px;
@@ -34,4 +34,4 @@
34
34
  flex-wrap: wrap;
35
35
  align-items: center;
36
36
  }
37
- `;exports.ChipInputWrapper=p,exports.OpenDropdownContainer=n,exports.OverLapAbs=o;
37
+ `;exports.ChipInputWrapper=s,exports.OpenDropdownContainer=n,exports.OverLapAbs=o;
@@ -12,6 +12,7 @@ export declare const DropdownPopover: React.ForwardRefExoticComponent<OpenDropdo
12
12
  showTooltipArrow?: boolean | undefined;
13
13
  allowEvents?: boolean | undefined;
14
14
  'data-test'?: string | undefined;
15
+ isChildLoading?: boolean | undefined;
15
16
  } & React.RefAttributes<{
16
17
  openDropdown: boolean;
17
18
  }>>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("../../../node_modules/react/jsx-runtime.js"),o=require("react"),n=require("react-popper"),s=require("../../dropShadow/DropShadow.js"),r=require("../../tooltips/Tooltip.js"),l=require("../Common.styled.js"),i=require("../OpenedDropdown/components/OpennedDropdown.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const p=a(o).default.forwardRef(((a,p)=>{var{children:d,onDropdownVisbilityChange:u,version:c="1.0",tooltipContent:j,tooltipDirection:x,showTooltipArrow:v}=a,w=e.__rest(a,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow"]);const m=p,[b,h]=o.useState(!1),[f,E]=o.useState(null),[D,O]=o.useState(null),g=o.useRef(null),{styles:R,attributes:y}=n.usePopper(f,D,{placement:w.placement,strategy:w.strategy}),S=e=>{var t,o;"2.0"===c&&w.isMultiSelect&&e&&(null===(t=w.onSelect)||void 0===t||t.call(w,[...e])),h(!1),null===(o=null==w?void 0:w.onClose)||void 0===o||o.call(w)};o.useImperativeHandle(m,(()=>({openDropdown:b})),[]),o.useEffect((()=>{(null==m?void 0:m.current)&&(m.current.openDropdown=b)}),[b]),o.useEffect((()=>{null==u||u(b)}),[b]);const C=()=>t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",Object.assign({style:{position:"relative"},ref:E},{children:[t.jsxRuntimeExports.jsx(l.OverLapAbs,Object.assign({ref:g,allowEvents:w.allowEvents,disabled:w.disabled,onClick:e=>{var t;null===(t=w.onDropdownOpen)||void 0===t||t.call(w),b?(h(!1),e.preventDefault()):w.disabled||h(!0)}},{children:w.allowEvents?d:null})),w.allowEvents?null:d]})),b&&t.jsxRuntimeExports.jsx(l.OpenDropdownContainer,Object.assign({ref:O,style:Object.assign(Object.assign({},R.popper),{zIndex:3})},y.popper,{"data-test":w["data-test"]},{children:t.jsxRuntimeExports.jsx(s.DropShadow,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:t.jsxRuntimeExports.jsx(i.OpenedDropdown,Object.assign({},w,{onSelect:e=>{var t;"2.0"===c&&w.isMultiSelect||(null===(t=w.onSelect)||void 0===t||t.call(w,e),h(!1))},onClose:S,version:c,headerRef:g,zeroState:null==w?void 0:w.zeroState}))}))}))]});return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:b||void 0===j?C():t.jsxRuntimeExports.jsx(r.Tooltip,Object.assign({body:j,placement:x,hideArrow:!v},{children:t.jsxRuntimeExports.jsx("div",Object.assign({"data-test":w["data-test"]},{children:C()}))}))})}));p.displayName="DropdownPopover",exports.DropdownPopover=p;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("../../../node_modules/react/jsx-runtime.js"),o=require("react"),n=require("react-popper"),s=require("../../dropShadow/DropShadow.js"),r=require("../../tooltips/Tooltip.js"),i=require("../Common.styled.js"),l=require("../OpenedDropdown/components/OpennedDropdown.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=a(o).default.forwardRef(((a,d)=>{var{children:p,onDropdownVisbilityChange:u,version:c="1.0",tooltipContent:j,tooltipDirection:x,showTooltipArrow:v,isChildLoading:w}=a,m=e.__rest(a,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow","isChildLoading"]);const h=d,[b,f]=o.useState(!1),[g,E]=o.useState(null),[D,O]=o.useState(null),R=o.useRef(null),{styles:y,attributes:S}=n.usePopper(g,D,{placement:m.placement,strategy:m.strategy}),C=e=>{var t,o;"2.0"===c&&m.isMultiSelect&&e&&(null===(t=m.onSelect)||void 0===t||t.call(m,[...e])),f(!1),null===(o=null==m?void 0:m.onClose)||void 0===o||o.call(m)};o.useImperativeHandle(h,(()=>({openDropdown:b})),[]),o.useEffect((()=>{(null==h?void 0:h.current)&&(h.current.openDropdown=b)}),[b]),o.useEffect((()=>{null==u||u(b)}),[b]);const q=()=>t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",Object.assign({style:{position:"relative"},ref:E},{children:[t.jsxRuntimeExports.jsx(i.OverLapAbs,Object.assign({ref:R,allowEvents:m.allowEvents,disabled:m.disabled,onClick:e=>{var t;null===(t=m.onDropdownOpen)||void 0===t||t.call(m),b?(f(!1),e.preventDefault()):m.disabled||f(!0)},isChildLoading:w},{children:m.allowEvents?p:null})),m.allowEvents?null:p]})),b&&t.jsxRuntimeExports.jsx(i.OpenDropdownContainer,Object.assign({ref:O,style:Object.assign(Object.assign({},y.popper),{zIndex:3})},S.popper,{"data-test":m["data-test"]},{children:t.jsxRuntimeExports.jsx(s.DropShadow,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:t.jsxRuntimeExports.jsx(l.OpenedDropdown,Object.assign({},m,{onSelect:e=>{var t;"2.0"===c&&m.isMultiSelect||(null===(t=m.onSelect)||void 0===t||t.call(m,e),f(!1))},onClose:C,version:c,headerRef:R,zeroState:null==m?void 0:m.zeroState}))}))}))]});return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:b||void 0===j?q():t.jsxRuntimeExports.jsx(r.Tooltip,Object.assign({body:j,placement:x,hideArrow:!v},{children:t.jsxRuntimeExports.jsx("div",Object.assign({"data-test":m["data-test"]},{children:q()}))}))})}));d.displayName="DropdownPopover",exports.DropdownPopover=d;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),o=require("../dropdown/DropdownPopover/index.js");require("../dropdown/Dropdown.js"),require("../dropdown/ChipDropdown.js"),require("react"),require("../zeroState/ZeroState.js"),require("../TypographyStyle.js"),require("../../constants/Theme.js"),require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js");var r=require("../button/Button.js");require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var t=require("./DropdownButton.style.js");exports.DropdownButton=n=>e.jsxRuntimeExports.jsxs(t.DropdownButtonStyle,Object.assign({type:n.buttonProps.buttonType,disabled:n.buttonProps.disabled},{children:[e.jsxRuntimeExports.jsx(r.Button,Object.assign({},n.buttonProps,{style:{borderRadius:"0px",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:"0px"}})),e.jsxRuntimeExports.jsx("div",{className:"divider"}),e.jsxRuntimeExports.jsx(o.DropdownPopover,Object.assign({},n.dropdownProps,{children:e.jsxRuntimeExports.jsx(r.Button,Object.assign({},n.buttonProps,{buttonText:"",TrailingIcon:n.iconProps,style:{borderRadius:"0px",borderTopRightRadius:"4px",borderBottomRightRadius:"4px"}}))}))]}));
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),o=require("../../node_modules/react/jsx-runtime.js"),r=require("../dropdown/DropdownPopover/index.js");require("../dropdown/Dropdown.js"),require("../dropdown/ChipDropdown.js"),require("react"),require("../zeroState/ZeroState.js"),require("../TypographyStyle.js"),require("../../constants/Theme.js"),require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js");var t=require("../button/Button.js");require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var n=require("../button/themes.js"),s=require("../spinner/Spinner.js"),i=require("./DropdownButton.style.js");exports.DropdownButton=d=>{var p,u;const j=d.buttonProps,a=e.__rest(j,["onClick"]);return o.jsxRuntimeExports.jsxs(i.DropdownButtonStyle,Object.assign({type:d.buttonProps.buttonType,disabled:d.buttonProps.disabled},{children:[(null===(p=d.buttonProps)||void 0===p?void 0:p.isLoading)&&o.jsxRuntimeExports.jsx(i.LoaderContainer,{children:o.jsxRuntimeExports.jsx(s.Spinner,{className:"spinner",size:"small",color:n.SpinnerColorMap(d.buttonProps.buttonType||"primary",d.buttonProps.inverse)})}),o.jsxRuntimeExports.jsx(t.Button,Object.assign({},d.buttonProps,{isLoading:!1,style:{borderRadius:"0px",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:"0px"}})),o.jsxRuntimeExports.jsx("div",{className:"dd-button-divider"}),o.jsxRuntimeExports.jsx(r.DropdownPopover,Object.assign({},d.dropdownProps,{isChildLoading:null===(u=d.buttonProps)||void 0===u?void 0:u.isLoading},{children:o.jsxRuntimeExports.jsx(t.Button,Object.assign({},a,{isLoading:!1,buttonText:"",TrailingIcon:d.iconProps,style:{borderRadius:"0px",borderTopRightRadius:"4px",borderBottomRightRadius:"4px"}}))}))]}))};
@@ -3,3 +3,4 @@ export declare const DropdownButtonStyle: import("styled-components").StyledComp
3
3
  type: Type | undefined;
4
4
  disabled: boolean | undefined;
5
5
  }, never>;
6
+ export declare const LoaderContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,9 +1,22 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const n=r(e).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=r(e);const n=i.default.div`
2
2
  display: flex;
3
3
  flex-direction: row;
4
4
  width: max-content;
5
- .divider {
5
+ position: relative;
6
+ align-items: stretch;
7
+ .dd-button-divider {
6
8
  width: ${e=>["primary","destructive"].includes(e.type)?"1px":"0px"};
7
9
  background-color: ${e=>{return r=e.type,(null==e?void 0:e.disabled)?t.COLORS.content.inactive:"primary"===r?"#CDA2FC":t.COLORS.content.primaryInverse;var r}};
8
10
  }
9
- `;exports.DropdownButtonStyle=n;
11
+ `,o=i.default.div`
12
+ position: absolute;
13
+ inset: 0;
14
+ display: flex;
15
+ flex-direction: row;
16
+ align-items: center;
17
+ justify-content: center;
18
+ width: 100%;
19
+ border-radius: 4px;
20
+ background: ${t.BASE_COLORS.brand[50]};
21
+ z-index: 3;
22
+ `;exports.DropdownButtonStyle=n,exports.LoaderContainer=o;
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import React from 'react';
3
3
  import { Collection, CollectionFetcherReturn, SelectedItems } from '.';
4
4
  import { CollectionsActions, SelectedCollectionsActions } from './reducers';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ApplicationType } from '@bikdotai/bik-models/growth';
2
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
3
  import { ButtonProps } from '../button/model';
4
4
  import { FooterForNonModalI, OUT_OF_STOCK_ACTION, ScreenName } from './type';
5
5
  export interface ProductVariant {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth"),o=require("../../assets/icons/search.svg.js"),s=require("react"),r=require("../../constants/Theme.js"),c=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"),p=require("./productInfoOverlay.js"),x=require("./productScreen.js"),h=require("./rearrangeScreen.js"),j=require("./reducers.js"),m=require("./searchScreen.js"),S=require("./selectedScreen.js"),C=require("./style.js"),g=require("./type.js"),y=require("./utility.js");exports.ProductPickerModal=R=>{const{storeId:b,selectedItems:f,onClose:E,visible:v,zIndex:k,exactLimit:I,limit:O,hideCollectionCheckbox:F,hideProductCheckbox:P,outOfStockAction:T=g.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,hideSelectionCount:N,title:A,width:B,left:w,renderWithoutModal:L,onClickSave:M,pickerType:V,hideProductVariants:z=!1,startupScreen:$=g.ScreenName.Collections,rearrangeEnabled:_,selectSingleItem:H=!1,showProductDetails:K,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:U={},primaryButton:Y,secondaryButton:J,subtitle:Q}=R,X=R.appType||t.ApplicationType.BIK,[Z,ee]=s.useReducer(j.collectionsReducer,{}),[te,oe]=s.useState([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections),[se,re]=s.useState("grid"),[ce,ne]=s.useState(""),[ie,le]=s.useState(""),[ae,de]=s.useState(0),[ue,pe]=s.useState(!1),[xe,he]=s.useState(0),[je,me]=s.useState(""),[Se,Ce]=s.useState(!1),[ge,ye]=s.useState(!1),[Re,be]=s.useReducer(j.searchReducer,{collections:{},products:{}}),[fe,Ee]=s.useReducer(j.selectedColectionsReducer,Object.keys(f).length>0?f:{}),ve=s.useRef(null),[ke,Ie]=s.useState(!1),[Oe,Fe]=s.useState();s.useEffect((()=>{pe(!0),ye(!0),R.collectionFetcher(ae,b,X).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),pe(!1),de((e=>e+1)),ye(!1)})).catch()}),[]),s.useEffect((()=>{let e=0;z?Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s;"-1"!==t&&fe[-1]&&(null===(s=fe[-1].products)||void 0===s?void 0:s[o])||(e+=1)}))})):Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s,r;Object.keys((null===(r=null===(s=fe[t].products)||void 0===s?void 0:s[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),he(e)}),[Z,fe,z]),s.useEffect((()=>{ie&&(pe(!0),R.productFetcher(ie,b,X).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:ie,products:e}}),pe(!1)})).catch())}),[ie]),s.useEffect((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(je.length||"collections"!==te)&&(je.length?(Ce(!0),R.searchFetcher(b,je,X).then((e=>{"collections"in e&&"products"in e?(be({type:"set",data:e}),ee({type:"searched",data:e.collections}),ee({type:"searched",data:e.products})):(be({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),pe(!1),Ce(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[je]),s.useEffect((()=>{M&&(R.onAdd(fe,xe),Pe())}),[M]),s.useEffect((()=>{H&&Object.keys(fe||{}).length&&xe&&(R.onAdd(fe,xe),Pe())}),[H,fe,xe]);const Pe=()=>{Ee({type:"reset",data:{}})},Te=()=>I&&xe>I?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${I} products`,type:"negative"}):O&&xe>O?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):xe>0?e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>{oe(_?g.ScreenName.RearrangeProducts:g.ScreenName.SelectedProducts)},buttonText:I?`${xe}/${I} products selected`:`${xe} products selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}):e.jsxRuntimeExports.jsx(n.Button,{disabled:!0,buttonText:I?`${xe}/${I} products selected`:`${xe} products selected`,buttonType:"tertiaryGray"}),De=e=>ue?"Loading...":te===g.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",qe=e.jsxRuntimeExports.jsxs(C.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[R.postHeader&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:R.postHeader})),!R.hideGlobalSearch&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:("collections"===te||"searchProducts"===te)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:L?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsxRuntimeExports.jsx(i.Input,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Se?e.jsxRuntimeExports.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):e.jsxRuntimeExports.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:je,onChangeText:e=>{e.length&&e.trim().length?me(e):me("")}})}))}),e.jsxRuntimeExports.jsxs(C.ScrollContainerStyle,Object.assign({ref:ve,screenName:te},{children:["collections"===te&&e.jsxRuntimeExports.jsx(u.CollectionsScreen,{customCollectionRestriction:R.customCollectionRestriction,dataLoading:ge,collections:Z,selectedCollectionsDispatch:Ee,setCollectionId:ne,setSelectedCollectionId:le,setScreen:oe,selectedCollections:fe,collectionFetcher:R.collectionFetcher,storeId:b,appType:X,collectionsDispatch:ee,setSaveDisabled:pe,pagingControls:{curPage:ae,setCurPage:de},hideCollectionCheckbox:F,renderWithoutModal:L,pickerType:V,scrollContainerRef:ve}),"products"===te&&ce&&e.jsxRuntimeExports.jsx(j.CollectionIdContext.Provider,Object.assign({value:ce},{children:e.jsxRuntimeExports.jsx(x.ProductsScreen,{hideInCollectionSearch:R.hideInCollectionSearch,customCollectionRestriction:R.customCollectionRestriction,productFetcher:R.productFetcher,setScreen:oe,storeId:b,appType:X,data:Z[ce],collectionsDispatch:ee,selectedCollectionsDispatch:Ee,selectedData:fe,setSaveDisabled:pe,searchInCollectionFetcher:R.searchInCollectionFetcher,hideProductCheckbox:P,outOfStockAction:T,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,renderWithoutModal:L,pickerType:V,hideProductVariants:z,fbStatusFetcher:R.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Fe(e)},showProductDetailInfoIcon:K,scrollContainerRef:ve})})),"view"===te&&e.jsxRuntimeExports.jsx(S.SelectedScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,hideProductVariants:z,outOfStockAction:T,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"rearrange"===te&&e.jsxRuntimeExports.jsx(h.RearrangeScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,outOfStockAction:T,rearrangeViewType:"grid"===se?"list":"grid",scrollContainerRef:ve,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"searchProducts"===te&&e.jsxRuntimeExports.jsx(m.SearchScreen,{customCollectionRestriction:R.customCollectionRestriction,selectedCollections:fe||{},searchedCollections:Re||{},searchedCollectionsDispatch:be,selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,onBackPress:()=>{me(""),be({type:"set",data:{collections:{},products:{}}})},pickerType:V,hideProductCheckbox:P,hideProductVariants:z,hideVariantCheckbox:D,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher,setCollectionId:ne,setSelectedCollectionId:le,renderWithoutModal:L,hideCollectionCheckbox:F,outOfStockAction:T})]}))]}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:L?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[qe,U.renderFooter?e.jsxRuntimeExports.jsxs(C.StyledFooterForNonModal,{children:[Te(),e.jsxRuntimeExports.jsx(n.Button,{buttonText:De(U.primaryButtonText),disabled:!U.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||U.primaryButtonDisabled,isLoading:U.isLoading,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections)}})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),ke&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,outOfStockAction:T,useDynamicInfoImageSize:R.useDynamicInfoImageSize,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}):e.jsxRuntimeExports.jsxs(l.StyledModal,Object.assign({zIndex:k,open:v,onClose:()=>{null==E||E(),Pe()},headingTitle:A||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),headingSubtitle:Q,footerShadow:!0,centralContainerStyles:{width:B||"600px",left:w||"auto"},headerRightCustomElement:G?e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:E},{children:e.jsxRuntimeExports.jsx(c.default,{width:20,height:20,color:r.COLORS.content.secondary})})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),footerContainerStyle:R.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:Y?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||e.disabled,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections)}}))(Y):{buttonText:De(),disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{R.onAdd(fe,xe),Pe()}},secondaryButton:J?(e=>Object.assign(Object.assign({},e),{disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{const e=y.updateAllVariantsForSelectedProducts(fe,Z,Re);R.onAdd(e,xe,!0)}}))(J):void 0,wrapperStyle:R.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):Te(),hideCrossButton:ke||G},{children:[qe,ke&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,useDynamicInfoImageSize:R.useDynamicInfoImageSize,outOfStockAction:T,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}))})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth/models/bik-store"),o=require("../../assets/icons/search.svg.js"),s=require("react"),r=require("../../constants/Theme.js"),c=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"),p=require("./productInfoOverlay.js"),x=require("./productScreen.js"),h=require("./rearrangeScreen.js"),j=require("./reducers.js"),m=require("./searchScreen.js"),S=require("./selectedScreen.js"),C=require("./style.js"),g=require("./type.js"),y=require("./utility.js");exports.ProductPickerModal=R=>{const{storeId:b,selectedItems:f,onClose:E,visible:k,zIndex:v,exactLimit:I,limit:O,hideCollectionCheckbox:F,hideProductCheckbox:P,outOfStockAction:T=g.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,hideSelectionCount:N,title:A,width:B,left:w,renderWithoutModal:L,onClickSave:M,pickerType:V,hideProductVariants:z=!1,startupScreen:$=g.ScreenName.Collections,rearrangeEnabled:_,selectSingleItem:H=!1,showProductDetails:K,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:U={},primaryButton:Y,secondaryButton:J,subtitle:Q}=R,X=R.appType||t.ApplicationType.BIK,[Z,ee]=s.useReducer(j.collectionsReducer,{}),[te,oe]=s.useState([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections),[se,re]=s.useState("grid"),[ce,ne]=s.useState(""),[ie,le]=s.useState(""),[ae,de]=s.useState(0),[ue,pe]=s.useState(!1),[xe,he]=s.useState(0),[je,me]=s.useState(""),[Se,Ce]=s.useState(!1),[ge,ye]=s.useState(!1),[Re,be]=s.useReducer(j.searchReducer,{collections:{},products:{}}),[fe,Ee]=s.useReducer(j.selectedColectionsReducer,Object.keys(f).length>0?f:{}),ke=s.useRef(null),[ve,Ie]=s.useState(!1),[Oe,Fe]=s.useState();s.useEffect((()=>{pe(!0),ye(!0),R.collectionFetcher(ae,b,X).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),pe(!1),de((e=>e+1)),ye(!1)})).catch()}),[]),s.useEffect((()=>{let e=0;z?Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s;"-1"!==t&&fe[-1]&&(null===(s=fe[-1].products)||void 0===s?void 0:s[o])||(e+=1)}))})):Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s,r;Object.keys((null===(r=null===(s=fe[t].products)||void 0===s?void 0:s[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),he(e)}),[Z,fe,z]),s.useEffect((()=>{ie&&(pe(!0),R.productFetcher(ie,b,X).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:ie,products:e}}),pe(!1)})).catch())}),[ie]),s.useEffect((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(je.length||"collections"!==te)&&(je.length?(Ce(!0),R.searchFetcher(b,je,X).then((e=>{"collections"in e&&"products"in e?(be({type:"set",data:e}),ee({type:"searched",data:e.collections}),ee({type:"searched",data:e.products})):(be({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),pe(!1),Ce(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[je]),s.useEffect((()=>{M&&(R.onAdd(fe,xe),Pe())}),[M]),s.useEffect((()=>{H&&Object.keys(fe||{}).length&&xe&&(R.onAdd(fe,xe),Pe())}),[H,fe,xe]);const Pe=()=>{Ee({type:"reset",data:{}})},Te=()=>I&&xe>I?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${I} products`,type:"negative"}):O&&xe>O?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):xe>0?e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>{oe(_?g.ScreenName.RearrangeProducts:g.ScreenName.SelectedProducts)},buttonText:I?`${xe}/${I} products selected`:`${xe} products selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}):e.jsxRuntimeExports.jsx(n.Button,{disabled:!0,buttonText:I?`${xe}/${I} products selected`:`${xe} products selected`,buttonType:"tertiaryGray"}),De=e=>ue?"Loading...":te===g.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",qe=e.jsxRuntimeExports.jsxs(C.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[R.postHeader&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:R.postHeader})),!R.hideGlobalSearch&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:("collections"===te||"searchProducts"===te)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:L?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsxRuntimeExports.jsx(i.Input,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Se?e.jsxRuntimeExports.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):e.jsxRuntimeExports.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:je,onChangeText:e=>{e.length&&e.trim().length?me(e):me("")}})}))}),e.jsxRuntimeExports.jsxs(C.ScrollContainerStyle,Object.assign({ref:ke,screenName:te},{children:["collections"===te&&e.jsxRuntimeExports.jsx(u.CollectionsScreen,{customCollectionRestriction:R.customCollectionRestriction,dataLoading:ge,collections:Z,selectedCollectionsDispatch:Ee,setCollectionId:ne,setSelectedCollectionId:le,setScreen:oe,selectedCollections:fe,collectionFetcher:R.collectionFetcher,storeId:b,appType:X,collectionsDispatch:ee,setSaveDisabled:pe,pagingControls:{curPage:ae,setCurPage:de},hideCollectionCheckbox:F,renderWithoutModal:L,pickerType:V,scrollContainerRef:ke}),"products"===te&&ce&&e.jsxRuntimeExports.jsx(j.CollectionIdContext.Provider,Object.assign({value:ce},{children:e.jsxRuntimeExports.jsx(x.ProductsScreen,{hideInCollectionSearch:R.hideInCollectionSearch,customCollectionRestriction:R.customCollectionRestriction,productFetcher:R.productFetcher,setScreen:oe,storeId:b,appType:X,data:Z[ce],collectionsDispatch:ee,selectedCollectionsDispatch:Ee,selectedData:fe,setSaveDisabled:pe,searchInCollectionFetcher:R.searchInCollectionFetcher,hideProductCheckbox:P,outOfStockAction:T,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,renderWithoutModal:L,pickerType:V,hideProductVariants:z,fbStatusFetcher:R.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Fe(e)},showProductDetailInfoIcon:K,scrollContainerRef:ke})})),"view"===te&&e.jsxRuntimeExports.jsx(S.SelectedScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,hideProductVariants:z,outOfStockAction:T,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"rearrange"===te&&e.jsxRuntimeExports.jsx(h.RearrangeScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,outOfStockAction:T,rearrangeViewType:"grid"===se?"list":"grid",scrollContainerRef:ke,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"searchProducts"===te&&e.jsxRuntimeExports.jsx(m.SearchScreen,{customCollectionRestriction:R.customCollectionRestriction,selectedCollections:fe||{},searchedCollections:Re||{},searchedCollectionsDispatch:be,selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,onBackPress:()=>{me(""),be({type:"set",data:{collections:{},products:{}}})},pickerType:V,hideProductCheckbox:P,hideProductVariants:z,hideVariantCheckbox:D,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher,setCollectionId:ne,setSelectedCollectionId:le,renderWithoutModal:L,hideCollectionCheckbox:F,outOfStockAction:T})]}))]}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:L?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[qe,U.renderFooter?e.jsxRuntimeExports.jsxs(C.StyledFooterForNonModal,{children:[Te(),e.jsxRuntimeExports.jsx(n.Button,{buttonText:De(U.primaryButtonText),disabled:!U.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||U.primaryButtonDisabled,isLoading:U.isLoading,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections)}})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),ve&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,outOfStockAction:T,useDynamicInfoImageSize:R.useDynamicInfoImageSize,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}):e.jsxRuntimeExports.jsxs(l.StyledModal,Object.assign({zIndex:v,open:k,onClose:()=>{null==E||E(),Pe()},headingTitle:A||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),headingSubtitle:Q,footerShadow:!0,centralContainerStyles:{width:B||"600px",left:w||"auto"},headerRightCustomElement:G?e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:E},{children:e.jsxRuntimeExports.jsx(c.default,{width:20,height:20,color:r.COLORS.content.secondary})})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),footerContainerStyle:R.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:Y?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||e.disabled,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections)}}))(Y):{buttonText:De(),disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{R.onAdd(fe,xe),Pe()}},secondaryButton:J?(e=>Object.assign(Object.assign({},e),{disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{const e=y.updateAllVariantsForSelectedProducts(fe,Z,Re);R.onAdd(e,xe,!0)}}))(J):void 0,wrapperStyle:R.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):Te(),hideCrossButton:ve||G},{children:[qe,ve&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,useDynamicInfoImageSize:R.useDynamicInfoImageSize,outOfStockAction:T,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}))})};
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import React from 'react';
3
3
  import { Collection, FbStatusFetcherReturn, Product, ProductFetcherReturn, ProductVariant, SelectedItems } from '.';
4
4
  import { CollectionsActions, SelectedCollectionsActions } from './reducers';
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import React from 'react';
3
3
  import { FbStatusFetcherReturn, SelectedItems } from '.';
4
4
  import { SelectedCollectionsActions } from './reducers';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ApplicationType } from '@bikdotai/bik-models/growth';
2
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
3
  import { Collection, FbStatusFetcherReturn, SearchedItems, SelectedItems } from '.';
4
4
  import { SearchReducerActions, SelectedCollectionsActions } from './reducers';
5
5
  import { OUT_OF_STOCK_ACTION } from './type';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ApplicationType } from '@bikdotai/bik-models/growth';
2
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
3
  import { Collection, FbStatusFetcherReturn, SelectedItems } from '.';
4
4
  import { SelectedCollectionsActions } from './reducers';
5
5
  import { OUT_OF_STOCK_ACTION } from './type';
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import { Collection, FbStatusFetcherReturn, Product, ProductVariant, SearchedItems, SelectedItems } from './modal';
3
3
  import { CollectionsActions } from './reducers';
4
4
  export declare const liftTheStateUp: (payload: any, data: any) => any;
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import { VariableListInterfaceV2 } from "../add-variableV2/AddVariableV2";
3
3
  import { CarouselProduct } from "./modalElements/EditWhatsAppCarouselTemplateV2";
4
4
  import { WhatsAppCarouselTemplateVariables } from "../template-preview/models/WhatsappCarouselTemplate";
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import { VariableV3 } from "../../../helpers";
3
3
  import React, { LegacyRef } from 'react';
4
4
  import Slider from 'react-slick';